Probably at least one of the constraints in the following list is one you don't want.

这个提示并不是出错,不理会它我的程序也没出现什么问题

但是处于强迫症,还是努力寻找解决的方法。。。

最终发现问题如下:

在xib各种绘制和添加约束的UITableViewCell之后,在某一特定情况想要隐藏这个Cell,于是我就在UITableView的

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath方法中返回0,所以出现了这个提示!

这里需要注意到一个问题:

有些人可能会想到通过reloadData方法,然后在

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath方法中return nil来实现隐藏这个Cell,

这样是行不通的。。会报错!

我的解决方法如下:

就是另外创建一个什么内容都没有的Cell来取代这个要隐藏的Cell,然后在

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath方法中返回0即可。

原文地址:https://www.cnblogs.com/Rinpe/p/5124963.html