XIb中使用tableview報錯UIViewAlertForUnsatisfiableConstraints

1.使用斷點(diǎn)工具并不能找出錯誤,最后仔細(xì)看了下報錯信息

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沒有我設(shè)置的自視圖大,而且我對cell設(shè)置了clips to view = YES。
約束就存在了沖突,xcode報錯提示。

把cell的高度調(diào)大或者view的高度調(diào)小解決

? ?
? ?
? ?

友情鏈接:

技術(shù)博客 ???????簡書主頁

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1.badgeVaule氣泡提示 2.git終端命令方法> pwd查看全部 >cd>ls >之后桌面找到文件夾內(nèi)容...
    i得深刻方得S閱讀 4,975評論 1 9
  • 2017.02.22 可以練習(xí),每當(dāng)這個時候,腦袋就犯困,我這腦袋真是神奇呀,一說讓你做事情,你就犯困,你可不要太...
    Carden閱讀 1,490評論 0 1
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,905評論 25 709
  • 我又感冒了,為什么要用個又呢,因為每年到這種忽冷忽熱的季節(jié),我都會重感冒個幾次,整個人昏昏沉沉的,不斷打噴嚏。 感...
    珺二爺閱讀 225評論 2 2
  • 愛情這么神秘, 多少人, 迷失在交錯的花間路上。 愛是什么, 為何, 心甘情愿溺死于, 仲夏之夜的星空下。 有錯么...
    1時依1閱讀 265評論 0 3

友情鏈接更多精彩內(nèi)容