ios – 这是什么布局约束?
我已经阅读了与此类似的所有SO问题,我很丢失.我收到以下错误:
2015-09-14 22:59:40.455 guess-who[60143:9602686] 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:0x7c0f8e30 UIImageView:0x7b6efb60.top == _UILayoutGuide:0x7c0f67a0.top>","<_UILayoutSupportConstraint:0x7c0f8ae0 V:[_UILayoutGuide:0x7c0f67a0(0)]>","<_UILayoutSupportConstraint:0x7c0f0070 _UILayoutGuide:0x7c0f67a0.bottom == UIView:0x7c0f65e0.bottom>","<NSAutoresizingMaskLayoutConstraint:0x7b6f6130 h=--& v=--& UIImageView:0x7b6efb60.midY == + 204>","<NSAutoresizingMaskLayoutConstraint:0x7b6f6160 h=--& v=--& V:[UIImageView:0x7b6efb60(220)]>","<NSLayoutConstraint:0x7b6f6dc0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7c0f65e0(518)]>","<NSAutoresizingMaskLayoutConstraint:0x7b6f6e20 h=-&- v=-&- 'UIView-Encapsulated-Layout-Top' V:|-(0)-[UIView:0x7c0f65e0] (Names: '|':UIView:0x7c0effc0 )>" ) Will attempt to recover by breaking constraint <_UILayoutSupportConstraint:0x7c0f0070 _UILayoutGuide:0x7c0f67a0.bottom == UIView:0x7c0f65e0.bottom> 我已经得到了一些我已经成功解决的其他约束,但是这个限制了我.我不知道UILayoutSupportConstraint是什么;文档不是很彻底.我查看了调试器和UIView的视图:0x7c0f65e0似乎是指我的主视图(虽然它是一个空白视图的孩子,出于某种原因?).我无法找到任何带有0x7c0f67a0的东西,虽然这似乎是指LayoutGuide,说它们的底部必须相等.我不确定我可以使用哪些其他工具来解决这个问题. 编辑: 使用View Debugger,我把它缩小到这两个约束中的一个,我不知道它们的来源: 我无法找到其中任何一个设置.我知道每个人的第一个建议是将translatesAutoresizingMaskIntoConstraints设置为false,但这会破坏我的整个布局,我不知道如何修复它. 解决方法
您还可以考虑向视图添加辅助功能标识符和约束标识符,以使AL日志更清晰:
constraintVariableName.identifier =“constraintVariableName”; 在InterfaceBuilder中,使用检查器中的identifier属性. self.loginButton.accessibilityLabel = NSLocalizedString(“LoginButtonAccessibilityLabel”,@“”); 这些id将最终出现在日志中,例如您在上面发布的内容,用UID替换UIView,UIImageView和UIConstraint等内容. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |