最近在自定义UICollectionViewCell,cell里面UITextView约束如下:

        inputTextView.snp.makeConstraints { (make) inmake.left.top.equalTo(self).offset(kAdaptedWidth(10))make.right.bottom.equalTo(self).offset(kAdaptedWidth(-10))}

结果编译报以下打印警告:

[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.
<__NSArrayI 0x60000128e9d0>(
<SnapKit.LayoutConstraint:0x60000385f660@GoodsTypeInputCollectionViewCell.swift#22 UITextView:0x7fbb870f1000.top ==app.GoodsTypeInputCollectionViewCell:0x7fbb86c4a430.top + 10.0>,
<SnapKit.LayoutConstraint:0x60000385f720@GoodsTypeInputCollectionViewCell.swift#24 UITextView:0x7fbb870f1000.bottom == app.HYGoodsTypeInputCollectionViewCell:0x7fbb86c4a430.bottom - 10.0>,
<NSLayoutConstraint:0x600003f528a0 'UIView-Encapsulated-Layout-Height' app.GoodsTypeInputCollectionViewCell:0x7fbb86c4a430.height == 0   (active)>
)Will attempt to recover by breaking constraint
<SnapKit.LayoutConstraint:0x60000385f720@GoodsTypeInputCollectionViewCell.swift#24 UITextView:0x7fbb870f1000.bottom == app.GoodsTypeInputCollectionViewCell:0x7fbb86c4a430.bottom - 10.0>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

原因是我的cell刚开始高度为0,在某些条件下,会变成另外一个height,然而由于CollectionView会默认添加两个约束就是UIView-Encapsulated-Layout-Width 和UIView-Encapsulated-Layout-Hight保证大小适中,但是我的cell的高度刚开始默认为0,它的系统默认约束和我的设置的约束权限冲突,造成的。

因此只需要降低自己约束权限就行了:

        inputTextView.snp.makeConstraints { (make) inmake.left.top.equalTo(self).offset(kAdaptedWidth(10))make.right.equalTo(self).offset(kAdaptedWidth(-10))make.bottom.equalTo(self).offset(kAdaptedWidth(-10)).priorityLow()}

这样都没有约束警告log

ios SnapKit 约束Unable to simultaneously satisfy constraints 和UIView-Encapsulated-Layout-Height的警告相关推荐

  1. iOS 使用符号断点定位警告约束警告-[LayoutConstraints] Unable to simultaneously satisfy constraints

    约束的警告 使用符号断点定位警告 Symbol Module 模块筛选 Condition 触发条件 Ignore 触发开始次数 Action 触发活动 AppleScript 脚本 Capture ...

  2. iOS 自动布局 Autolayout 报错:Unable to simultaneously satisfy constraints.

    在使用自动布局时,不断的报下面的错误: Unable to simultaneously satisfy constraints. Probably at least one of the const ...

  3. Unable to simultaneously satisfy constraints

    [aSubView mas_makeConstraints:^(MASConstraintMaker *make) {         make.left.equalTo(self).offset(1 ...

  4. [LayoutConstraints] Unable to simultaneously satisfy constraints.

    [aSubView mas_makeConstraints:^(MASConstraintMaker *make) {make.left.equalTo(self).offset(10);make.r ...

  5. Unable to simultaneously satisfy constraints.这一问题

    工作了这么久一直没做什么记录之类的,想想还是要记录点什么就像上学时的笔记一样,有可能以后没什么大用处,但至少也是自己的经历,以后看了说不定会会心一笑呢. 闲话就到此为止了.最近在搭一个界面用到了自动布 ...

  6. masonry Unable to simultaneously satisfy constraints. Probably at least one of the c

    Unable to simultaneously satisfy constraints. Probably at least one of the 在使用masonry 进行布局的时候出现了类似的问 ...

  7. Unable to simultaneously satisfy constraints.

    开发版本  7.0 @property(nonatomic) BOOL translatesAutoresizingMaskIntoConstraints NS_AVAILABLE_IOS(6_0); ...

  8. 自动布局报错(两条连线冲突):Unable to simultaneously satisfy constraints

    这个报错有些长: Unable to simultaneously satisfy constraints.     Probably at least one of the constraints ...

  9. iOS 自动布局报错:Unable to simultaneously satisfy constraints.

    这种错误,一般就两个原因: 1,约束设置错误,或者约束设置重复,这一种把约束全部删除掉再重新添加约束. 2,忘记设置控件的:setTranslatesAutoresizingMaskIntoConst ...

最新文章

  1. tcpip卷一二三区别_八年级物理期末试卷(内附初三期末卷)
  2. 软件工程之“个人附加题”
  3. php 递归实现无限极分类和排序_Laravel框架实现无限极分类
  4. Shell入门(五)之参数
  5. Flink中的容错机制
  6. java上传kafka的方法_哪种方法是将所有数据从Kafka主题复制到接收器(文件或Hive表)的最佳方法?...
  7. 为什么chm(帮助文档)打不开
  8. Java程序员常用开发工具有哪些?
  9. MongoDB 宣布已收购数据库托管公司 mLab
  10. 阿里巴巴 JAVA 开发手册
  11. c语言选择题题及答案,C语言选择题练习及答案.doc
  12. C语言中sprintf函数的用法
  13. RequestBody Ajax写法
  14. 思科路由器配置命令(四)
  15. 轻松解决vscode官网下载慢问题
  16. 阿里优酷视频分类方法???咋理解啊?
  17. 为什么游戏模型不如原画好看?
  18. session_unset和session_distory
  19. 国产迪王耀全球(上)
  20. 知物由学 | 舆情数据清洗“动”“静”分离方案

热门文章

  1. 杰理烧录器驱动安装失败
  2. Node 10.0+ 初级入门-姜威-专题视频课程
  3. 织梦dedecms响应式精密机械模具公司网站模板(自适应手机移动端)
  4. 机房环境监控系统品牌-深圳计通
  5. 无线通信模块——WiFi,蓝牙,2.4G
  6. matlab实现大气湍流退化模型算法,大气湍流下退化序列图像的目标检测方法
  7. 凹凸世界服务器维护到几点,凹凸世界手游2021年7月21日版本更新停服维护公告_凹凸世界手游2021年7月21日更新了什么_菜鸟游戏网...
  8. bga封装扇出过孔_Altium Designer BGA扇出
  9. 测量工具----示波器
  10. 商务通“隐形手机”牛皮轰轰可以休矣!