UIToolbar 未位于设备底部,但在故事板中显示正常 [英] UIToolbar not positioned at the bottom on device but appears ok in storyboard
问题描述
我正在 XCode 6 中测试新的通用故事板.我基本上创建了一个视图,工具栏位于底部.当我在 iPad 中运行该基本示例时,工具栏不在底部
I'm testing the new universal storyboard in XCode 6. I basically created a view with a toolbar positioned at the bottom. When I run that basic example in the iPad the toolbar is not at the bottom
这里是故事板
如何将 UIToolbar 放在底部并使用所有不同屏幕的所有可用宽度?
How can I place the UIToolbar at the bottom and using all the available width for all different screens?
推荐答案
使用自动布局.在工具栏上设置左边距、右边距和底部空间约束,使其停靠在底部.如果您希望工具栏高度不是标准的 44,则可以选择添加高度约束.
Use Autolayout. Set the left margin, right margin and bottom space constraints on the toolbar to make it dock at the bottom. Optionally, add a height constraint if you want the toolbar height to be something other than the standard 44.
故事板工具栏上的约束应如下所示:
Your constraints on your toolbar in the storyboard should look like this:
这篇关于UIToolbar 未位于设备底部,但在故事板中显示正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!