How to refresh UICollectionViewCell in iOS 7?

后端 未结 3 1501
半阙折子戏
半阙折子戏 2021-02-04 15:04

I am trying to develop my app in Xcode 5 and debug it under iOS 7 environment.

I have a customized UICollectionViewLayoutAttributes.

I plan to do something after

3条回答
  •  长发绾君心
    2021-02-04 15:53

    Yes. As Calman said you must override isEqual: method to compare custom properties that you have. See the apple documentation here

    If you subclass and implement any custom layout attributes, you must also override the inherited isEqual: method to compare the values of your properties. In iOS 7 and later, the collection view does not apply layout attributes if those attributes have not changed. It determines whether the attributes have changed by comparing the old and new attribute objects using the isEqual: method. Because the default implementation of this method checks only the existing properties of this class, you must implement your own version of the method to compare any additional properties. If your custom properties are all equal, call super and return the resulting value at the end of your implementation.

提交回复
热议问题