如何找出不必要的约束constraints in following list is one you don't want
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:0x166eb400 V:[UIView:0x166ea400(37)]>", "<NSLayoutConstraint:0x16524b60 UIView:0x166ea400.height == 0.0894*UIView:0x16526700.width>", "<NSAutoresizingMaskLayoutConstraint:0x1a3b68f0 h=-&- v=-&- UIView:0x16526700.width == UIView:0x1656da10.width>", "<NSAutoresizingMaskLayoutConstraint:0x1a3b6f30 h=--& v=--& H:[UIView:0x1656da10(320)]>"
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
严格讲,上述提示并不是出错的约束,而是多余的约束,比如设置了上、下边距,同时又pin了高度,就会导致出现这样的问题。感觉你的问题应该是设置了UIView:0x166ea400高度为37,然后又设置它等于另一个UIView:0x16526700宽度的0.0894。这样就冗余了。
而排查的方法是,在storyboard中挨个找UIView,37是个很好的切入点,我是这样做的,很笨。
说你设置了一个View的高度等于另外一个view1的宽度,view1的宽度又等于view2的宽度,然后view2的宽度不是确定值,会引起冲突,这种应该是设置约束优先级的问题?