繁体   English   中英

iOS 8自定义自调整表格视图:无法同时满足约束

[英]iOS 8 Custom Self Sizing Table View : Unable to simultaneously satisfy constraints

UITableViewController ,我正在使用自定义UITableView单元格。 此单元包含UIImage对细胞的左侧和两个控制UILabels (一个为产品名称和其他为产品描述,其可具有不同长度),以此的权利UIImage 我在所有三个控件上都添加了“自动布局”约束。 自动版式控件没有问题。 但是,当我运行该应用程序时,我收到以下错误消息(表中的每一行一个),并且最上面的几行不符合自动布局约束,但是当我向下滚动然后向上滚动时,所有内容都会呈现根据自动布局约束

Debug Log:
-----------------------------------------------------------------------------
- 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:0x170085ff0 H:[PFImageView:0x14ee1d350(60)]>",
    "<NSLayoutConstraint:0x17408a500 PFImageView:0x14ee1d350.leading == UITableViewCellContentView:0x14ee1cdf0.leadingMargin + 7>",
    "<NSLayoutConstraint:0x17408a5a0 UITableViewCellContentView:0x14ee1cdf0.trailingMargin == UILabel:0x14ed08580'Naturally Sandstone Slabs'.trailing + 10>",
    "<NSLayoutConstraint:0x17408a5f0 H:[PFImageView:0x14ee1d350]-(11)-[UILabel:0x14ed08580'Naturally Sandstone Slabs']>",
    "<NSLayoutConstraint:0x17008c6c0 'fittingSizeHTarget' H:[UITableViewCellContentView:0x14ee1cdf0(34)]>" )

Will attempt to recover by breaking constraint  <NSLayoutConstraint:0x170085ff0 H:[PFImageView:0x14ee1d350(60)]>

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.

问题是因为我在表格视图中使用了披露指标。 降低标签的跟踪到超级视图约束的优先级。 (我选择990)解决了该问题。

以下是我获得解决方案的链接:

添加披露指标时,ios8单元约束被破坏

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM