约束不符合大小类

时间:2014-10-08 22:23:43

标签: ios objective-c storyboard autolayout constraints

我试图将iPhone和iPad故事板转换成能够识别Size Classes的单一故事板。为此,我需要能够在iPhone和iPad之间更改一个特定的图像宽度,并在iPad上启用/禁用一个约束。

以下是我的图片宽度约束的截图: enter image description here

据我所知,在iPhone上运行时应使用230,否则应使用400,对吗?

以下是我在iPad上不需要禁用的约束的屏幕截图:

enter image description here

出于某种原因,在iPhone 5/6/6 +模拟器上运行此操作时,我收到Unable to simultaneously satisfy constraints.警告:

(
    "<NSLayoutConstraint:0x7f99f17704e0 H:[UIImageView:0x7f99f1770370(400)]>",
    "<NSLayoutConstraint:0x7f99f17718d0 UIView:0x7f99f1771710.width == IATextFieldEx:0x7f99f1768be0.width + 160>",
    "<NSLayoutConstraint:0x7f99f1773210 UIImageView:0x7f99f1770370.width == IATextFieldEx:0x7f99f17639e0.width>",
    "<NSLayoutConstraint:0x7f99f17734e0 H:[UIView:0x7f99f1771710]-(0)-|   (Names: '|':UIView:0x7f99f1771620 )>",
    "<NSLayoutConstraint:0x7f99f1773580 H:|-(0)-[UIView:0x7f99f1771710]   (Names: '|':UIView:0x7f99f1771620 )>",
    "<NSLayoutConstraint:0x7f99f1492ce0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f99f1771620(320)]>",
    "<NSLayoutConstraint:0x7f99f1732250 IATextFieldEx:0x7f99f1768be0.width == IATextFieldEx:0x7f99f17639e0.width>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f99f17718d0 UIView:0x7f99f1771710.width == IATextFieldEx:0x7f99f1768be0.width + 160>

我错过了一些明显的东西吗?为什么Xcode仍在使用w:任何h:在iPhone上运行时有任何限制吗?

1 个答案:

答案 0 :(得分:0)

不能轻易将其添加到评论中,所以它在答案中。它应该显示像这样安装的大小类。如果不是,那就出问题了 - 尝试重新创建约束?

enter image description here