3
我得到一个自动布局错误,我不明白:自动布局错误和标识
2013-03-14 18:30:48.842 driver[7177:907] 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:0x1ede73e0 UILabel:0x1ede4320.top == PriceCell:0x1edcd0c0.top + 160>",
"<NSLayoutConstraint:0x1ede7460 V:[UILabel:0x1ede4320]-(7)-[UIImageView:0x1ede45d0]>",
"<NSLayoutConstraint:0x1ede74a0 UIImageView:0x1ede45d0.centerY == UIImageView:0x1f856810.centerY>",
"<NSLayoutConstraint:0x1ede7880 UIImageView:0x1f856810.top == PriceCell:0x1edcd0c0.top + 30>",
"<NSLayoutConstraint:0x1ede78c0 UIImageView:0x1f856810.bottom == PriceCell:0x1edcd0c0.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0x1f83f340 h=--& v=--& V:[PriceCell:0x1edcd0c0(300)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1ede7460 V:[UILabel:0x1ede4320]-(7)-[UIImageView:0x1ede45d0]>
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.
问题:从错误列表,我不能确定哪个UI自动布局所指的元素。所以我回到故事板,并将我的tableviewcell中的每个UI元素分配给Restoration Id字段中的标识符。我在某处读过错误消息中的十六进制数字,然后将其替换为分配给相应UI元素的名称。但不幸的是,这并没有发生。那么,我在这里做错了什么,或者我错过了什么?
设置标识符应该可以工作。但是你总是可以在调试器中运行'po 0x1ede4320',甚至可以在'po [0x1ede4320 text]'或'p [0x1ede4320 frame]'上运行'看看它是否有助于识别它们。 – paulmelnikow 2013-03-14 19:19:44
无法在iOS中设置视图标识符。主要失败,苹果! – phatmann 2013-04-15 16:14:40