How did I get this with Interface Builder (and is

2019-08-06 13:39发布

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>

1条回答
Animai°情兽
2楼-- · 2019-08-06 14:20

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.

查看更多
登录 后发表回答