[英]Arranging bottom toolbar issues iOS7
I apologize in advance for the unusual stack question here, but I'm having some terrible difficulty(refer the image below) 我提前为这里不寻常的堆栈问题道歉,但我遇到了一些可怕的困难(参见下图)
I'm trying to set a UIToolbar
or UIView
or maybe even a UITableViewCell
at the bottom of this view where I can set my create button but when I attempt to do so, they all align to the top to fit underneath the cell above (the one containing the UITextView
). 我试图在这个视图的底部设置一个
UIToolbar
或UIView
或者甚至是UITableViewCell
,我可以设置我的创建按钮,但是当我尝试这样做时,它们都对齐到顶部以适合上面的单元格下方(一个包含UITextView
)。
Aside from this, I need the UIButton
( no matter what it lies in ) to remain at the bottom of the view, regardless of screen size. 除此之外,无论屏幕大小如何,我都需要将
UIButton
( 无论它位于何处 )保留在视图的底部。
In other words, the "create" button needs to stay at the bottom of the view for 3.5-inch retina and 4-inch retina. 换句话说,“创建”按钮需要留在视图的底部,用于3.5英寸视网膜和 4英寸视网膜。
Currently I have placed down a UIView
, expanded it to the bottom of the UITableViewController
, layer a toolbar at the bottom of the view and then placed the UIButton
in the toolbar. 目前我放下了一个
UIView
,将它扩展到UITableViewController
的底部,在视图底部层叠一个工具栏,然后将UIButton
放在工具栏中。
What am I doing wrong? 我究竟做错了什么?
Instead of using a container view such as UIToolbar
or UIView
, you can do this with just a UIButton
. 您可以仅使用
UIButton
来执行此操作,而不是使用UIToolbar
或UIView
等容器视图。 However, if you are intending to add more than one buttons, then UIToolbar
is probably gonna be a better choice. 但是,如果您打算添加多个按钮,那么
UIToolbar
可能会是更好的选择。
Anyways, to pin a control to the bottom of your screen regardless of size, you need to set its vertical spacing to the Bottom Layout Guide
in your storyboard. 无论如何,无论大小如何,要将控件固定到屏幕底部,都需要将其垂直间距设置为故事板中的“
Bottom Layout Guide
。
Please make sure your UIButton
is on the top of UITableView
not below. 请确保您的
UIButton
位于UITableView
的顶部,而不是下方。 To ensure that, make sure UIButton
is listed below UITableView
in the Interface Builder's document tree. 为确保这一点,请确保
UIButton
列在Interface Builder文档树中的UITableView
下面。
Here is a screenshot of how your UIButton
constraints and position in the document tree may look like! 以下是您的
UIButton
约束和文档树中的位置可能如何的截图!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.