UICollectionViewCell在出列时不会自动调用updateConstraints? [英] UICollectionViewCell not calling updateConstraints automatically when dequeued?

查看:154
本文介绍了UICollectionViewCell在出列时不会自动调用updateConstraints?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UICollectionViewCell子类。我写了一个 updateConstraints 方法,因为我之前做了一百次。由于某些原因,当细胞出列时从未调用过。我必须在将其取消后添加对 [cell setNeedsUpdateConstraints] 的手动调用。

I have a UICollectionViewCell subclass. I wrote an updateConstraints method as I've done a hundred times before. For some reason that is never called when the cell is dequeued. I had to add a manual call to [cell setNeedsUpdateConstraints] after dequeueing it.

任何想法可能会发生什么在这里?

Any idea what could be going on here?

推荐答案

实现此方法并返回YES。这可能会有所帮助。

Implement this method and return YES. This could probably help.

+ (BOOL)requiresConstraintBasedLayout

详情:

https://stackoverflow.com/a/23616469/1300262

这篇关于UICollectionViewCell在出列时不会自动调用updateConstraints?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆