我是如何通过 Interface Builder 得到这个的(它是否“合法”)
所以这里有一个奇怪的。我一直在结合界面生成器和 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确实不应该直接编辑 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.