美文网首页
警告Unable to simultaneously satis

警告Unable to simultaneously satis

作者: 生命不止运动不息 | 来源:发表于2021-01-10 15:41 被阅读0次

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.

UITableView的tableHeaderView或footerView, 或者sectionHeaderView的出现此问题的警告

原因是:限定冲突。

目前发现了3种情况:

  1. 设置tableHeaderView 和tableFooterView。 且使用了限定。
解决: 为你的header或footer再包一层View。

2.设置table的sectionHeader或footer. 即继承UITableViewHeaderFooterView。

解决: 将继承UITableViewHeaderFooterView的view内的子视图不要直接添加到contentView上,而将所有子视图,都添加到一个容器视图,再将容器加到contentView上。容器不要用限定。 其实和上面那个类似,都是包一层。

3.自定义View中含有scrollView. 然后scrollView中的子视图等,都用frame布局,但是自定义View在其父视图中确是使用限定。此种情况,也会弹限定冲突警告。

解决:全部使用限定。不要使用frame.

相关文章

网友评论

      本文标题:警告Unable to simultaneously satis

      本文链接:https://www.haomeiwen.com/subject/gnnkaktx.html