首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用NSLayoutConstraint出错

使用NSLayoutConstraint出错
EN

Stack Overflow用户
提问于 2015-01-18 21:32:57
回答 1查看 140关注 0票数 1

我有2 storyBoards。第一个是一个名为“tableViewController”的st1,它有带有5个标签、5个textFields和2个按钮的静态单元格。下一个storyBoard -一个名为"st2“的viewController有一个tableView。

当我从st1到st2时,它会给出下面的错误。

我使用的是尺寸类和自动布局。

代码语言:javascript
复制
2015-01-18 13:10:40.199 myApp[1108:35975] 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:0x7fa1f1d2a310 V:[UITextField:0x7fa1f1d283c0(30)]>",

    "<NSLayoutConstraint:0x7fa1f1d30780 UITextField:0x7fa1f1d283c0.top == UITableViewCellContentView:0x7fa1f1d271a0.topMargin>",

    "<NSLayoutConstraint:0x7fa1f1d30870 UITableViewCellContentView:0x7fa1f1d271a0.bottomMargin == UITextField:0x7fa1f1d283c0.bottom - 3>",

    "<NSLayoutConstraint:0x7fa1f1d64d00 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fa1f1d271a0(43.5)]>"

)



Will attempt to recover by breaking constraint 



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.

它会显示此错误5次。我把它剪掉这样就更容易读懂了。

我是个初学者,你可能知道,所以请不要对我太苛刻。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-18 22:02:17

它看起来像是在抱怨,因为您已经将文本字段的高度限制为30 (即第一个约束中的'(30)‘),但您也希望在其单元格的上边缘设置文本字段的顶部,在单元格的底部边缘设置底部,而单元格的高度为43.5。因此,您同时要求文本字段的高度为30和40.5,这是一个冲突。

要么约束文本字段的顶部和底部,而不设置高度

设置高度,不要设置底部约束

调整单元格的高度(可能不是最佳解决方案)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28015053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档