UICollectionViewCell not calling updateConstraints automatically when dequeued?

♀尐吖头ヾ 提交于 2019-12-23 09:33:30

问题


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?


回答1:


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

+ (BOOL)requiresConstraintBasedLayout

For details:

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



来源:https://stackoverflow.com/questions/23117248/uicollectionviewcell-not-calling-updateconstraints-automatically-when-dequeued

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!