iOS:在xib视图及其superview之间添加约束 [英] iOS: add constraints between a xib view and its superview

查看:1686
本文介绍了iOS:在xib视图及其superview之间添加约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将视图从xib文件添加到表视图控制器,然后将其放在视图外,以便当用户点击按钮时,视图从导航栏下向下滚动以显示。这里是下降的视图:

I'm adding a view from a xib file to a table view controller and then placing this out of view so that when the user taps a button the view scrolls down from under the navigation bar to be visible. Here's the view that drops down:

这在iPhone 6上可以正常工作,但任何更小,下拉视图失去了它的约束,看起来像下面这样混乱:

This works fine on iPhone 6 but anything smaller and the drop down view loses its constraints and looks all jumbled up like below:

>

我相信这是case,因为没有设置下拉视图和表视图(超级视图)之间的约束。我使用 PureLayout 但是,因为iOS8.3 / Xcode 6.3这似乎没有做任何事了。

I believe this is the case because there are no constraints being set between the drop down view and the table view (the superview). I was using PureLayout however since iOS8.3/Xcode 6.3 this doesn't seem to do anything anymore.

我有什么选项可以为下拉视图添加约束,使其与父视图的顶部,左侧和右侧边缘对齐?

What options do i have for adding a constraint to drop down view so it is aligned with the top, left and right edges of the superview?

谢谢

推荐答案

解决:我最终只是手动设置xib视图的框架为不同的屏幕尺寸创建

Solved: I ended up just setting the frame of the xib view manually upon creation for the different screen sizes

这篇关于iOS:在xib视图及其superview之间添加约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆