项目中自定义Cell,控件使用autoLayout来设置约束,发现运行页面表现正常,但是控制台报如下错误:

 Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
() look at each constraint and try to figure out which you don't expect;
() find the code that added the unwanted constraint or constraints and fix it.
(
<NSLayoutConstraint:0x10c30ee10 V:[UILabel:0x10c30ebb0'Label'(21.6667)]>,
<NSLayoutConstraint:0x10c30f9c0 V:[UIView:0x10c30ea20()]>,
<NSLayoutConstraint:0x10c30fab0 V:|-()-[UILabel:0x10c30ebb0'Label'] (Names: '|':UIView:0x10c30ea20 )>,
<NSLayoutConstraint:0x10c30fb00 V:[UILabel:0x10c30ebb0'Label']-()-[UILabel:0x10c30f080'Label']>,
<NSLayoutConstraint:0x10c30fb50 UILabel:0x10c30f080'Label'.height == UILabel:0x10c30ebb0'Label'.height>,
<NSLayoutConstraint:0x10c30fc90 V:[UILabel:0x10c30f3d0'Label']-()-| (Names: '|':UIView:0x10c30ea20 )>,
<NSLayoutConstraint:0x10c30fd80 V:[UILabel:0x10c30f080'Label']-()-[UILabel:0x10c30f3d0'Label']>
) Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10c30ee10 V:[UILabel:0x10c30ebb0'Label'(21.6667)]> 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.

问题:

表示约束发生冲突,查看错误信息,其中一个label报约束冲突:

发现在cell中设置的label高度为21.6

但实际代码中计算的label高度为21.667,并设置label高度约束为21.667

说明label约束冲突了

解决办法:

在cell中找到这个label,找到这个label的高度约束,对其优先级进行减一操作,

以前是1000,改为999,即当xib中设置的高度约束与代码中更新的高度约束不一致时,

取代码中设置的值。

最新文章

  1. Servlet的生命周期
  2. WebLogic部署
  3. JVM-程序编译与代码晚期(运行期)优化
  4. C# RichTextBox 滚动条 滚动到最后一行
  5. Android 使用Fragment,ViewPagerIndicator 制作csdn app主要框架
  6. tomcat6.0 数据库连接池配置问题
  7. Android 判断当前联网的类型 wifi、移动数据流量
  8. 使用pd设计表的 多对多的中间表的设计方式, 有图有真相
  9. android LayoutInflater和inflate()方法的用法(转载)
  10. Visual Studio 2013 Use HTTPS (SSL) On Web Application Projects
  11. css的学习笔记
  12. Codeforces Round #442 (Div. 2)
  13. ES6的字符串和数值的扩展
  14. NODE 模块 FS-EXTRA
  15. Java基础之随机生成数字和字母
  16. 学习Struts--Chap05:值栈和OGNL
  17. GMM-实现聚类的代码示例
  18. Android六大进程间通信方式总结之一:基本知识
  19. CDN对于动态加速是否有效
  20. [六省联考2017]组合数问题 (矩阵优化$dp$)

热门文章

  1. 词法分析器总结--flex&amp;bison
  2. js 内置对象常用方法
  3. pyqt加载图片
  4. asp.net添加用户
  5. python操作word
  6. oozie中时间EL表达式
  7. 虚拟化–操作系统级 LXC Linux Containers内核轻量级虚拟化技术
  8. IOC控制反转
  9. jenkins环境搭建&amp;配置(二)
  10. 学习shader之前必须知道的东西之计算机图形学(一)渲染管线