无法同时满足约束 - 没有任何约束 [英] Unable to simultaneously satisfy constraints - No constraints in place

查看:139
本文介绍了无法同时满足约束 - 没有任何约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成并删除了每个用户限制但在旋转设备后仍然出现以下错误 ONLY 。我完全不知道为什么。有没有人有任何想法?

I have gone through and removed every single user constraint yet I am still getting the following error ONLY after I rotate the device. I have absolutely no clue why though. Does anyone have any ideas?

2013-01-14 21:30:31.363 myApp[35869:c07] 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:0x84543d0 h=--& v=--& V:[UIView:0xa330270(768)]>",
    "<NSLayoutConstraint:0xa338350 V:[UIView:0xa331260]-(-1)-|   (Names: '|':UIView:0xa330270 )>",
    "<NSLayoutConstraint:0xa338390 V:|-(841)-[UIView:0xa331260]   (Names: '|':UIView:0xa330270 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0xa338350 V:[UIView:0xa331260]-(-1)-|   (Names: '|':UIView:0xa330270 )>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.


推荐答案

让我们一一看一下。

< NSAutoresizingMaskLayoutConstraint:0x84543d0 h = - & v = - & V:[UIView:0xa330270(768)]>

这是说视图0xa330270( A )必须是768点高。

This is saying view 0xa330270 (A) must be 768 points high.

< NSLayoutConstraint:0xa338350 V:[UIView:0xa331260] - ( - 1) - |(姓名:'|':UIView:0xa330270)>

这就是说视图0xa331260( B )的下边缘必须是<底部的-1的间隙strong> A ,这是它的超级视图。

This is saying view 0xa331260 (B)'s bottom edge must be a gap of -1 from the bottom of A, which is it's superview.

< NSLayoutConstraint:0xa338390 V:| - (841) - [UIView :0xa331260](姓名:'|':UIView:0xa330270)>

这就是说 B 其最高优势必须是超级视图顶部841点的差距, A

This is saying that B's top edge must be a gap of 841 points from the top of its superview, A.

这三件事情并非都是真的 - A 不能高达768分,并且包含一个带有顶边的子视图841从顶部插入点和从底部插入-1点。你在哪里定义了这些约束?

These three things can't all be true - A can't be 768 points high, and contain a subview with a top edge 841 points inset from the top and -1 points inset from the bottom. Where have you defined each of these constraints?

你还没有说出你想要实现的布局,但看起来你可能在superview上有一个自动调整遮罩,它可以防止它在你身高时发生变化旋转设备。据我所知,只有在以编程方式添加视图时才会出现自动调整约束,因为故事板或xib要么是全自动布局,要么是全自动布局。除非您正在执行类似添加自动布局视图(从笔尖加载?)到非自动布局笔尖的另一个视图的操作?

You haven't said what layout you are trying to achieve, but it looks like you might have an autoresizing mask on the superview that is preventing it changing in height when you rotate the device. As far as I know the autoresizing constraints only appear if you have added views programmatically, since a storyboard or xib is either all-autolayout, or not. Unless you are doing something like adding an auto laid out view (loaded from a nib?) to another view from a non-autolayout nib?

这篇关于无法同时满足约束 - 没有任何约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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