我是如何通过 Interface Builder 得到这个的(它是否“合法”)

发布于 2024-11-18 12:40:26 字数 2309 浏览 2 评论 0原文

所以这里有一个奇怪的。我一直在结合界面生成器和 .xib 文件的一些直接编辑,并且在某处我设法在工具栏上生成一个按钮(UIBarButtonItem),该按钮实际上在按钮下方有一个标签。

我非常喜欢这一点,如果我知道如何始终如一地获得它就好了。这是一个标准的事情,可以通过一些晦涩的方法使用 Interface Builder 来完成吗?或者是否有一种明确的方法只需编辑 .xib 文件即可实现此目的?

另请注意,通过编辑 .xib 文件,此处的工具栏也变得比正常工具栏更高。 Apple 会因为不符合 UI 风格指南而拒绝应用程序吗?


哦,意识到粘贴 .xib 文件中的一段代码可能很有用,所以这里是(希望相关的)部分:

                    <object class="IBUIToolbar" id="906120387">
                    <reference key="NSNextResponder" ref="380026005"/>
                    <int key="NSvFlags">1290</int>
                    <string key="NSFrame">{{0, 426}, {320, 54}}</string>
                    <reference key="NSSuperview" ref="380026005"/>
                    <bool key="IBUIOpaque">NO</bool>
                    <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
                    <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
                    <object class="NSMutableArray" key="IBUIItems">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                        <object class="IBUIBarButtonItem" id="594926440">
                            <string key="IBUITitle">belowbutton</string>
                            <object class="NSCustomResource" key="IBUIImage">
                                <string key="NSClassName">NSImage</string>
                                <string key="NSResourceName">gear_button.png</string>
                            </object>
                            <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
                            <float key="IBUIWidth">69</float>
                            <int key="IBUIStyle">1</int>
                            <reference key="IBUIToolbar" ref="906120387"/>
                        </object>
                    </object>
                    <object class="NSColor" key="IBUITintColor">
                        <int key="NSColorSpace">3</int>
                        <bytes key="NSWhite">MAA</bytes>
                    </object>
                </object>

So here's a weird one. I've been doing a combination of interface builder and some direct editing of the .xib file and somewhere along the line I managed to produce a button (UIBarButtonItem) on the Toolbar that actually has a label BENEATH the button.

Which I quite like, if only I knew how to get it consistently. Is this a standard thing that can be done with Interface Builder via some obscure methodology? Or is there a well-defined way to do it just by editing the .xib file?

Note too that the toolbar here has also been made taller than normal by editing the .xib file. Is that something that Apple would reject an app for because it doesn't conform to UI style guidelines?


Oh, realized that it might be useful to stick in a snippet of code from the .xib file, so here's the (hopefully pertinent) portion:

                    <object class="IBUIToolbar" id="906120387">
                    <reference key="NSNextResponder" ref="380026005"/>
                    <int key="NSvFlags">1290</int>
                    <string key="NSFrame">{{0, 426}, {320, 54}}</string>
                    <reference key="NSSuperview" ref="380026005"/>
                    <bool key="IBUIOpaque">NO</bool>
                    <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
                    <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
                    <object class="NSMutableArray" key="IBUIItems">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                        <object class="IBUIBarButtonItem" id="594926440">
                            <string key="IBUITitle">belowbutton</string>
                            <object class="NSCustomResource" key="IBUIImage">
                                <string key="NSClassName">NSImage</string>
                                <string key="NSResourceName">gear_button.png</string>
                            </object>
                            <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
                            <float key="IBUIWidth">69</float>
                            <int key="IBUIStyle">1</int>
                            <reference key="IBUIToolbar" ref="906120387"/>
                        </object>
                    </object>
                    <object class="NSColor" key="IBUITintColor">
                        <int key="NSColorSpace">3</int>
                        <bytes key="NSWhite">MAA</bytes>
                    </object>
                </object>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑,眼淚并存 2024-11-25 12:40:26

您确实不应该直接编辑 IB 文件。

我不认为苹果会因此而拒绝某个应用程序,因为许多应用程序通过在其他视图中引入视图来玩游戏,或者以其他方式玩弄普通组件的结构。我担心的是,IB 可能会因某些变化而感到困惑。

我不确定你如何实现标签效果,但它可能很难重现。

You really aren't supposed to edit IB files directly.

I don't think Apple will reject an app because of it, since many apps play games by introducing views inside of other views and otherwise playing with the structure of normal components. The thing I'd worry about would by that IB might be confused by some changes.

I'm not sure how you go the label effect to take place, but it might be hard to reproduce.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文