XIb中使用tableview报错UIViewAlertForUnsatisfiableConstraints

1.使用断点工具并不能找出错误,最后仔细看了下报错信息

2.报错信息

[LayoutConstraints] 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. 
(
    "<NSLayoutConstraint:0x608000098a60 UIView:0x7fcb7b428fe0.height == 50   (active)>",
    "<NSLayoutConstraint:0x608000098060 V:|-(0)-[UIView:0x7fcb7b428fe0]   (active, names: '|':UITableViewCellContentView:0x7fcb7b42bd40 )>",
    "<NSLayoutConstraint:0x608000097b60 V:[UIView:0x7fcb7b42ed00]-(0)-|   (active, names: '|':UITableViewCellContentView:0x7fcb7b42bd40 )>",
    "<NSLayoutConstraint:0x608000097c00 V:[UIView:0x7fcb7b428fe0]-(0)-[UIView:0x7fcb7b42ed00]   (active)>",
    "<NSLayoutConstraint:0x60000009bf80 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fcb7b42bd40.height == 49.5   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x608000098a60 UIView:0x7fcb7b428fe0.height == 50   (active)>

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.

3.分析

 "<NSLayoutConstraint:0x608000098a60 UIView:0x7fcb7b428fe0.height == 50   (active)>",
"<NSLayoutConstraint:0x60000009bf80 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fcb7b42bd40.height == 49.5   (active)>"

第一句代码信息是视图中有个界面的高度为50;
第二句中意思是cell_contentView的高度为49.5;

问题就来了

contentView没有我设置的自视图大,而且我对cell设置了clips to view = YES。
约束就存在了冲突,xcode报错提示。

把cell的高度调大或者view的高度调小解决

   
   
   

友情链接:

技术博客        简书主页

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1.badgeVaule气泡提示 2.git终端命令方法> pwd查看全部 >cd>ls >之后桌面找到文件夹内容...
    i得深刻方得S阅读 10,295评论 1 9
  • 2017.02.22 可以练习,每当这个时候,脑袋就犯困,我这脑袋真是神奇呀,一说让你做事情,你就犯困,你可不要太...
    Carden阅读 5,272评论 0 1
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 177,180评论 25 709
  • 我又感冒了,为什么要用个又呢,因为每年到这种忽冷忽热的季节,我都会重感冒个几次,整个人昏昏沉沉的,不断打喷嚏。 感...
    珺二爷阅读 1,508评论 2 2
  • 爱情这么神秘, 多少人, 迷失在交错的花间路上。 爱是什么, 为何, 心甘情愿溺死于, 仲夏之夜的星空下。 有错么...
    1时依1阅读 1,679评论 0 3

友情链接更多精彩内容