Ios 让约束在大小类中工作

Ios 让约束在大小类中工作,ios,xcode,Ios,Xcode,所以,我在玩Xcode 6 beta版中的大小类。我对图像设置了一些约束,使其根据与iPhone纵向和横向相对应的大小类别处于不同的位置 这些约束在下图中可见。正如您所看到的,当我在Compact/Compact中时,一些约束被“安装”,而其他约束则没有,而在Compact/Regular中,其他约束被安装 但是,我得到一个错误(在两个屏幕截图中略微可见),基本上说我卸载的约束干扰了我安装的约束(如果它们同时运行,则是真的),但是每个大小类的卸载约束不应该运行吗?所有已安装的约束都不会相互导

所以,我在玩Xcode 6 beta版中的大小类。我对图像设置了一些约束,使其根据与iPhone纵向和横向相对应的大小类别处于不同的位置

这些约束在下图中可见。正如您所看到的,当我在Compact/Compact中时,一些约束被“安装”,而其他约束则没有,而在Compact/Regular中,其他约束被安装

但是,我得到一个错误(在两个屏幕截图中略微可见),基本上说我卸载的约束干扰了我安装的约束(如果它们同时运行,则是真的),但是每个大小类的卸载约束不应该运行吗?所有已安装的约束都不会相互导致问题

显示的错误是:

2014-06-30 21:14:26.215 TV Tracker[26417:1434692] SetAppThreadPriority: setpriority failed with error 45
2014-06-30 21:14:26.372 TV Tracker[26417:1434692] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x10bb11da0 H:|-(24)-[UILabel:0x10bb4db70'TV Tracker uses your Trak...']   (Names: '|':UIControl:0x10bb2db60 )>",
"<NSLayoutConstraint:0x10bb11df0 H:[UIImageView:0x10bb44740]-(>=18)-[UILabel:0x10bb4db70'TV Tracker uses your Trak...']>",
"<NSLayoutConstraint:0x10bb2f420 H:|-(20)-[UIButton:0x10bb35470'Sign In']   (Names: '|':UIControl:0x10bb2db60 )>",
"<NSLayoutConstraint:0x10bb2f470 UIButton:0x10bb35470'Sign In'.leading == UIImageView:0x10bb44740.leading>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x10bb11df0 H:[UIImageView:0x10bb44740]-(>=18)-[UILabel:0x10bb4db70'TV Tracker uses your Trak...']>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-06-30 21:14:26.373 TV Tracker[26417:1434692] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x10bb11e90 H:[UILabel:0x10bb4db70'TV Tracker uses your Trak...']-(23)-|   (Names: '|':UIControl:0x10bb2db60 )>",
"<NSLayoutConstraint:0x10bb11ee0 UILabel:0x10bb4db70'TV Tracker uses your Trak...'.trailing == UIButton:0x10bb44ec0'Register'.trailing>",
"<NSLayoutConstraint:0x10bb2f510 H:[UIButton:0x10bb44ec0'Register']-(20)-|   (Names: '|':UIControl:0x10bb2db60 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x10bb11ee0 UILabel:0x10bb4db70'TV Tracker uses your Trak...'.trailing == UIButton:0x10bb44ec0'Register'.trailing>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-06-30 21:14:26.388 TV Tracker[26417:1434692] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSAutoresizingMaskLayoutConstraint:0x10bb49e10 h=-&- v=-&- UIControl:0x10bb2db60.width == UIViewControllerWrapperView:0x10d102000.width>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb55d10 h=-&- v=-&- UIViewControllerWrapperView:0x10d102000.width == UINavigationTransitionView:0x10bc6f770.width>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb3cda0 h=-&- v=-&- UINavigationTransitionView:0x10bc6f770.width == UILayoutContainerView:0x10bc6e3e0.width>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb29960 h=-&- v=-&- UILayoutContainerView:0x10bc6e3e0.width == UITransitionView:0x10bc73670.width>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb559e0 h=-&- v=-&- UITransitionView:0x10bc73670.width == UIWindow:0x10d068e70.width>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb56880 h=--- v=--- H:[UIWindow:0x10d068e70(320)]>",
"<NSLayoutConstraint:0x10bb2f420 H:|-(20)-[UIButton:0x10bb35470'Sign In']   (Names: '|':UIControl:0x10bb2db60 )>",
"<NSLayoutConstraint:0x10bb2f470 UIButton:0x10bb35470'Sign In'.leading == UIImageView:0x10bb44740.leading>",
"<NSLayoutConstraint:0x10bb44570 UIControl:0x10bb2db60.centerX == UIImageView:0x10bb44740.centerX>",
"<NSLayoutConstraint:0x10bb3c840 H:[UIImageView:0x10bb44740(92)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x10bb3c840 H:[UIImageView:0x10bb44740(92)]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-06-30 21:14:26.389 TV Tracker[26417:1434692] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<_UILayoutSupportConstraint:0x10bd1c8a0 V:[_UILayoutGuide:0x10bb4acb0(64)]>",
"<_UILayoutSupportConstraint:0x10bd1fbf0 V:|-(0)-[_UILayoutGuide:0x10bb4acb0]   (Names: '|':UIControl:0x10bb2db60 )>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb56d40 h=-&- v=-&- UIControl:0x10bb2db60.height == UIViewControllerWrapperView:0x10d102000.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb56c60 h=-&- v=-&- UIViewControllerWrapperView:0x10d102000.height == UINavigationTransitionView:0x10bc6f770.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb3cbb0 h=-&- v=-&- UINavigationTransitionView:0x10bc6f770.height == UILayoutContainerView:0x10bc6e3e0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb4a920 h=-&- v=-&- UILayoutContainerView:0x10bc6e3e0.height == UITransitionView:0x10bc73670.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb0e3a0 h=-&- v=-&- UITransitionView:0x10bc73670.height == UIWindow:0x10d068e70.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb44d20 h=--- v=--- V:[UIWindow:0x10d068e70(568)]>",
"<NSLayoutConstraint:0x10bb44520 UIControl:0x10bb2db60.centerY == UIImageView:0x10bb44740.centerY>",
"<NSLayoutConstraint:0x10bb445c0 V:[_UILayoutGuide:0x10bb4acb0]-(24)-[UIImageView:0x10bb44740]>",
"<NSLayoutConstraint:0x10bb49b60 V:[UIImageView:0x10bb44740(100)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x10bb49b60 V:[UIImageView:0x10bb44740(100)]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-06-30 21:14:26.396 TV Tracker[26417:1434692] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<_UILayoutSupportConstraint:0x10bd13470 V:[_UILayoutGuide:0x10bb4c690(0)]>",
"<_UILayoutSupportConstraint:0x10bd13410 _UILayoutGuide:0x10bb4c690.bottom == UIControl:0x10bb2db60.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb56d40 h=-&- v=-&- UIControl:0x10bb2db60.height == UIViewControllerWrapperView:0x10d102000.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb56c60 h=-&- v=-&- UIViewControllerWrapperView:0x10d102000.height == UINavigationTransitionView:0x10bc6f770.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb3cbb0 h=-&- v=-&- UINavigationTransitionView:0x10bc6f770.height == UILayoutContainerView:0x10bc6e3e0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb4a920 h=-&- v=-&- UILayoutContainerView:0x10bc6e3e0.height == UITransitionView:0x10bc73670.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb0e3a0 h=-&- v=-&- UITransitionView:0x10bc73670.height == UIWindow:0x10d068e70.height>",
"<NSAutoresizingMaskLayoutConstraint:0x10bb44d20 h=--- v=--- V:[UIWindow:0x10d068e70(568)]>",
"<NSLayoutConstraint:0x10bb11e40 UIControl:0x10bb2db60.centerY == UILabel:0x10bb4db70'TV Tracker uses your Trak...'.centerY + 0.25>",
"<NSLayoutConstraint:0x10bb2f3d0 V:[UILabel:0x10bb4db70'TV Tracker uses your Trak...']-(91)-[_UILayoutGuide:0x10bb4c690]>",
"<NSLayoutConstraint:0x10bb2d790 V:[UILabel:0x10bb4db70'TV Tracker uses your Trak...'(69)]>"
)

Will attempt to recover by breaking constraint 
2014-06-30 21:14:26.215电视跟踪器[26417:1434692]SetAppThreadPriority:setpriority失败,出现错误45
2014-06-30 21:14:26.372电视跟踪器[26417:1434692]无法同时满足约束条件。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
“=18)-[UILabel:0x10bb4db70'电视跟踪器使用您的Trak…']>”,
"",
""
)
将尝试通过打破约束进行恢复
=18)-[UILabel:0x10bb4db70'电视跟踪器使用您的Trak…']>
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
2014-06-30 21:14:26.373电视跟踪器[26417:1434692]无法同时满足约束条件。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
2014-06-30 21:14:26.388电视跟踪器[26417:1434692]无法同时满足约束条件。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
2014-06-30 21:14:26.389电视跟踪器[26417:1434692]无法同时满足约束条件。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
2014-06-30 21:14:26.396电视跟踪器[26417:1434692]无法同时满足约束条件。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复

在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。

紧凑/紧凑约束的侧栏如下所示

我的紧凑/常规约束侧栏如下所示

此登录控制器的“我的视图”层次结构:
我第一次尝试这个功能时也遇到了同样的问题,直到我意识到“+”按钮告诉我的是什么。起初,我更改了大小类,删除了一个视图并添加了一个视图,或者删除了一个约束并添加了一个约束。那是错误的!不能基于每个尺寸类别删除或添加视图或约束;它们必须在每个尺寸等级中都存在-只有其中一些标记为该尺寸等级的“已安装”,而其他则不是

这里有一些进一步的建议

  • 请看屏幕截图的顶部。您将从Interface Builder收到警告,并将忽略这些警告。
    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.