应用自动布局让UITableviewCell自适应高度出现下面问题

来源:互联网 发布:ogame 源码 编辑:程序博客网 时间:2024/06/05 09:40

控制台总是打印如下,感觉很不爽。

 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:0x11a7ec3e0 V:[UIView:0x11a7b2680(-2)]>"

)


Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x11a7ec3e0 V:[UIView:0x11a7b2680(-2)]>


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.



   最终在万能的stackoverflow查到答案,究其原因就是cell中有一个文字可变的label,还有一个装有图片数目不定的View,对这两个的高度设置autoLayout不知道先设置谁,因此产生冲突。只要把其中一个高度不定的控件的优先级设置成999,稍微低一级就可以消除。
  




0 0
原创粉丝点击