Layout properly in this case?

I have a UIView and a UITableView. I'm trying to align them in a way so they are sticked to each other. The UIView has a fixed height and I want the UITableView to consume the rest of the horizontal space.

I applied a set of constraints which got me pretty close to what I want to achieve but there's a problem that I don't know how to solve. The layout is OK in the portrait orientation but there's a gap between the two elements in the landscape mode. Please see the screenshots below.

纵向。 UIView和UITableView之间没有差距。

风景定位。有问题的。

Here are the constraint setups for the elements.

UITableView: (all constants are set to 0)

UITableView的约束设置

UIView: (all constants are set to 0 except for Height)

UIView的约束设置

Thanks in advance.


I had the same issue of that space appearing above the top cell of a UITableView.

Like yourself, I looked into the constraints and the properties of the table, though the only way I could fix the issue was to delete the UITableView altogether and re-insert it.

Once re-inserted the gap was gone.

链接地址: http://www.djcxy.com/p/91594.html

上一篇: 使用UIAlertView / Controller的Autolayout错误?

下一篇: 在这种情况下正确布局?