Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/122.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在控制台上获取奇怪的日志消息(自动布局)_Ios_Autolayout_Uicollectionview_Size Classes - Fatal编程技术网

Ios 在控制台上获取奇怪的日志消息(自动布局)

Ios 在控制台上获取奇怪的日志消息(自动布局),ios,autolayout,uicollectionview,size-classes,Ios,Autolayout,Uicollectionview,Size Classes,嗨,伙计们 我有一个600*450大小的视图,现在我把一个集合视图放在一个600*430大小的视图中。当我运行应用程序时,我在控制台上收到了这个奇怪的消息 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 an

嗨,伙计们

我有一个600*450大小的视图,现在我把一个集合视图放在一个600*430大小的视图中。当我运行应用程序时,我在控制台上收到了这个奇怪的消息

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:0x600000285960 V:|-(0)-[UICollectionView:0x7fb133860800]   (Names: '|':UIView:0x60000019df60 )>",
"<NSLayoutConstraint:0x600000285a50 V:[UICollectionView:0x7fb133860800]-(20)-|   (Names: '|':UIView:0x60000019df60 )>",
"<NSLayoutConstraint:0x600000285dc0 V:[_UILayoutGuide:0x6000001b5b60]-(0)-[UIView:0x60000019dc20]>",
"<NSLayoutConstraint:0x600000285e10 UIView:0x60000019dc20.height == 0.25*UIView:0x60000019db50.height>",
"<NSLayoutConstraint:0x6000002860e0 V:[_UILayoutGuide:0x6000001b5b60]-(0)-[UIView:0x60800019d5a0]>",
"<NSLayoutConstraint:0x600000286180 UIView:0x60000019df60.bottom == UIView:0x60000019ddc0.bottom>",
"<NSLayoutConstraint:0x600000286220 UIView:0x60000019df60.top == UIView:0x60800019d5a0.top>",
"<NSLayoutConstraint:0x600000286540 UIView:0x60000019dcf0.height == 0.25*UIView:0x60000019db50.height>",
"<NSLayoutConstraint:0x600000286590 V:[UIView:0x60000019dc20]-(0)-[UIView:0x60000019dcf0]>",
"<NSLayoutConstraint:0x6000002867c0 UIView:0x60000019ddc0.height == 0.25*UIView:0x60000019db50.height>",
"<NSLayoutConstraint:0x6000002868b0 V:[UIView:0x60000019dcf0]-(0)-[UIView:0x60000019ddc0]>",
"<NSLayoutConstraint:0x600000288d40 'UIView-Encapsulated-Layout-Height' V:[UIView:0x60000019db50(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000285a50 V:[UICollectionView:0x7fb133860800]-(20)-|   (Names: '|':UIView:0x60000019df60 )>

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. 
无法同时满足约束。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
我不知道该怎么办


我已将这4个约束应用于UICollectionView。

出现这种情况是因为您添加的约束很少,因此最好选择视图,然后选择“重置为建议的约束”

如果该约束未达到标记,则最好查找每个控制约束,并检查哪个约束显示标记(黄色),然后尝试手动删除,然后添加


希望它有帮助。

是否尝试添加宽度/高度约束?这可能会解决您的问题。我已经应用了@Rafalare,但没有使用@Rafalare将集合视图直接添加到控制器或任何其他视图中,如果您使用其他视图进行添加,请确保该视图也正确应用了约束。您的错误表明您正在使用比例高度约束,并且导致此日志。请尝试单击界面生成器中的“解决自动布局问题”,然后选择“更新约束”或“添加缺少的约束”。这可能会提示您问题出在哪里。