布局约束违规

时间:2016-04-05 08:30:38

标签: ios objective-c xcode autolayout

AppName [2338:563134]无法同时满足约束。     可能至少以下列表中的一个约束是您不想要的约束。     试试这个:         (1)看看每个约束,并试图找出你不期望的;         (2)找到添加了不需要的约束或约束的代码并修复它。

"<NSLayoutConstraint:0x16663190 V:[UIView:0x16663310(48)]>",
"<NSLayoutConstraint:0x16662f80 V:|-(0)-[UIView:0x16663310]   (Names: '|':UIView:0x16663400 )>",
"<NSLayoutConstraint:0x16662ef0 V:[UIView:0x166637e0]-(0)-|   (Names: '|':UIView:0x16663400 )>",
"<NSLayoutConstraint:0x16662ec0 V:[UIView:0x16663310]-(1)-[UIView:0x166637e0]>",
"<NSLayoutConstraint:0x16639fb0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x16663400(10)]>"

将尝试通过违反约束来恢复

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

UIViewAlertForUnsatisfiableConstraints 的结果显示

UIWindow:0x166a1d80
|   UILayoutContainerView:0x1658a4c0
|   |   UINavigationTransitionView:0x165a1970
|   |   |   UIViewControllerWrapperView:0x166bf650
|   |   |   |   •UIView:0x16665c30
|   |   |   |   |   *UIView:0x166678e0
|   |   |   |   |   |   UIView:0x165f95a0
|   |   |   |   |   |   |   •UIView:0x16557350
|   |   |   |   |   |   |   |   *Charts.BarChartView:0x17366800
|   |   |   |   |   |   |   |   *UIView:0x16557260
|   |   |   |   |   |   |   |   |   *UILabel:0x16557520'labeltext'
|   |   |   |   |   |   |   |   |   *UILabel:0x16557940'04/05/2016'
|   |   |   |   |   |   UIView:0x1665eec0
|   |   |   |   |   |   |   •UIView:0x165459e0
|   |   |   |   |   |   |   |   *Charts.BarChartView:0x16b60800
|   |   |   |   |   |   |   |   *UIView:0x165458f0
|   |   |   |   |   |   |   |   |   *UILabel:0x16545bd0'labeltext'
|   |   |   |   |   |   |   |   |   *UILabel:0x16545e50
|   |   |   |   |   |   UIView:0x1665dce0
|   |   |   |   |   |   |   •UIView:0x1664dd10
|   |   |   |   |   |   |   |   *Charts.BarChartView:0x17308a00
|   |   |   |   |   |   |   |   *UIView:0x1664dc20
|   |   |   |   |   |   |   |   |   *UILabel:0x1664df00'labeltext'
|   |   |   |   |   |   |   |   |   *UILabel:0x1664e180
|   |   |   |   |   *UIView:0x16665b70
|   |   |   |   |   *UIView:0x16665ab0
|   |   |   |   |   |   *home:0x1666ae80
|   |   |   |   |   |   *UIImageView:0x166677e0
|   |   |   |   |   |   *UIImageView:0x16665f10
|   |   |   |   |   |   *UIImageView:0x16669400
|   |   |   |   |   |   *UILabel:0x166659a0'labeltext'
|   |   |   |   |   |   *UIButton:0x1666c4f0
|   |   |   |   |   |   |   UIImageView:0x1655ec10
|   |   |   |   |   |   *UIView:0x16665670
|   |   |   |   |   |   |   *UILabel:0x166679a0'labeltext'
|   |   |   |   |   |   |   *UIButton:0x1666c390
|   |   |   |   |   |   |   |   UIImageView:0x1655e7b0
|   |   |   |   |   DrawingArea:0x16655440
|   |   |   |   |   |   UIView:0x1664a8f0
|   |   |   |   |   |   |   UIImageView:0x1664a9b0
|   |   |   |   |   |   |   UIImageView:0x1664fca0
|   |   |   |   |   |   |   UIImageView:0x1664fd80
|   |   |   |   |   |   |   UIImageView:0x1664fe60


I  made a trace for **po [[0x16663310 superview] recursiveDescription]** which is giving me

"UIView: 0x16663400; frame = (500 385; 10 10); autoresize = RM+BM; layer = CALayer: 0x166633d0"
   | "UIView: 0x16663310; frame = (0 0; 10 9); autoresize = RM+BM; layer = CALayer: 0x166632e0"
   |    | "UIButton: 0x166764f0; frame = (-30 -12; 32 33); opaque = NO; autoresize = RM+BM; layer = CALayer: 0x16665890"
   |    |    | "UIImageView: 0x178a5b70; frame = (0 0; 32 32); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = CALayer: 0x1663c0c0"
   |    | "UILabel: 0x16663550; frame = (8 5; 0 0); text = ''; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1666d660"
   | <UIView: 0x166637e0; frame = (0 10; 10 0); autoresize = RM+BM; layer = CALayer: 0x16663520>>.

如何解决这个问题,真的无法解决这个问题。 请帮忙

Document Outline of the Scene

0 个答案:

没有答案