我正在以编程方式使用自动布局约束来布局自定义UITableView单元,并且正确定义了 tableView:heightForRowAtIndexPath:
这是对iOS6的工作得很好,它的外观罚款iOS7以及
但是,当我在iOS7上运行该应用程序时,这是我在控制台中看到的消息:
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.
2013-10-02 09:56:44.847 Vente-Exclusive[76306:a0b] 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:0xac4c5f0 V:|-(15)-[UIImageView:0xac47f50] (Names: '|':UITableViewCellContentView:0xd93e850 )>",
"<NSLayoutConstraint:0xac43620 V:[UIImageView:0xac47f50(62)]>",
"<NSLayoutConstraint:0xac43650 V:[UIImageView:0xac47f50]-(>=0)-[UIView:0xac4d0f0]>",
"<NSLayoutConstraint:0xac43680 V:[UIView:0xac4d0f0(1)]>",
"<NSLayoutConstraint:0xac436b0 V:[UIView:0xac4d0f0]-(0)-| (Names: '|':UITableViewCellContentView:0xd93e850 )>",
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0xac43650 V:[UIImageView:0xac47f50]-(>=0)-[UIView:0xac4d0f0]>
而且的确有在该列表中,我不想约束之一:
"<NSAutoresizingMaskLayoutConstraint:0xac6b120 h=--& v=--& V:[UITableViewCellContentView:0xd93e850(44)]>"
而且我无法将的translatesAutoresizingMaskIntoConstraints属性设置contentView为NO =>会弄乱整个单元格。
44是默认的单元格高度,但是我在表格视图委托中定义了我的自定义高度,那么为什么单元格contentView具有此约束?是什么原因造成的?
在iOS6中这没有发生,并且在iOS6和iOS7上一切都看起来很好。
我的代码很大,因此我不会在这里发布它,但是如果您需要它,可以随时请求一个pastebin。
要指定我的操作方式,有关单元格初始化:
我创建了所有标签,按钮等
我将其translatesAutoresizingMaskIntoConstraints财产设置为“否”
我将它们添加为contentView单元格的子视图
我在 contentView
我也很想了解为什么仅在iOS7上会发生这种情况。
largeQ
12345678_0001
相关分类