UICollectionView(QMUICellHeightIndexPathCache)
@interface UICollectionView (QMUICellHeightIndexPathCache)
/// YES 表示在 reloadData、reloadIndexPath: 等方法被调用时,对应的缓存也会被自动更新,默认为 YES。仅对 indexPath 方式的缓存有效。
@property(nonatomic, assign) BOOL qmui_invalidateIndexPathHeightCachedAutomatically;
/// 在 UICollectionView 不同的大小下会得到不一样的 QMUICellHeightIndexPathCache 实例,从而保证大小变化时缓存自动刷新
@property(nonatomic, strong, readonly) QMUICellHeightIndexPathCache *qmui_indexPathHeightCache;
/// 搭配 QMUICellHeightIndexPathCache,清除指定 indexPath 的高度缓存,注意请不要直接使用 [self.qmui_indexPathHeightCache invalidateHeightAtIndexPath:],因为一个 UICollectionView 在不同宽度下会有不同的 QMUICellHeightIndexPathCache,直接使用那个 cache 的 invalidate 方法只能刷新当前的 cache,无法刷新其他宽度下的 cache。
- (void)qmui_invalidateHeightAtIndexPath:(NSIndexPath *)indexPath;
@end
Undocumented
-
YES 表示在 reloadData、reloadIndexPath: 等方法被调用时,对应的缓存也会被自动更新,默认为 YES。仅对 indexPath 方式的缓存有效。
Declaration
Objective-C
@property (nonatomic) BOOL qmui_invalidateIndexPathHeightCachedAutomatically;
Swift
var qmui_invalidateIndexPathHeightCachedAutomatically: Bool { get set }
-
在 UICollectionView 不同的大小下会得到不一样的 QMUICellHeightIndexPathCache 实例,从而保证大小变化时缓存自动刷新
Declaration
Objective-C
@property (nonatomic, strong, readonly) QMUICellHeightIndexPathCache *qmui_indexPathHeightCache;
Swift
var qmui_indexPathHeightCache: QMUICellHeightIndexPathCache! { get }
-
搭配 QMUICellHeightIndexPathCache,清除指定 indexPath 的高度缓存,注意请不要直接使用 [self.qmui_indexPathHeightCache invalidateHeightAtIndexPath:],因为一个 UICollectionView 在不同宽度下会有不同的 QMUICellHeightIndexPathCache,直接使用那个 cache 的 invalidate 方法只能刷新当前的 cache,无法刷新其他宽度下的 cache。
Declaration
Objective-C
- (void)qmui_invalidateHeightAtIndexPath:(NSIndexPath *)indexPath;
Swift
func qmui_invalidateHeight(at indexPath: IndexPath!)