UITableView(QMUIKeyedHeightCache)

@interface UITableView (QMUIKeyedHeightCache)

/// 在 UITableView 不同的宽度下会得到不一样的 QMUICellHeightCache 实例,从而保证宽度变化时缓存自动刷新
@property(nonatomic, strong, readonly) QMUICellHeightCache *qmui_keyedHeightCache;

/// 搭配 QMUICellHeightCache,清除指定 key 的高度缓存,注意请不要直接使用 [self.qmui_keyedHeightCache invalidateHeightForKey:],因为一个 UITableView 在不同宽度下会有不同的 QMUICellHeightCache,直接使用那个 cache 的 invalidate 方法只能刷新当前的 cache,无法刷新其他宽度下的 cache。
- (void)qmui_invalidateHeightForKey:(id<NSCopying>)key;

@end

Undocumented

  • 在 UITableView 不同的宽度下会得到不一样的 QMUICellHeightCache 实例,从而保证宽度变化时缓存自动刷新

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) QMUICellHeightCache *qmui_keyedHeightCache;

    Swift

    var qmui_keyedHeightCache: QMUICellHeightCache! { get }
  • 搭配 QMUICellHeightCache,清除指定 key 的高度缓存,注意请不要直接使用 [self.qmui_keyedHeightCache invalidateHeightForKey:],因为一个 UITableView 在不同宽度下会有不同的 QMUICellHeightCache,直接使用那个 cache 的 invalidate 方法只能刷新当前的 cache,无法刷新其他宽度下的 cache。

    Declaration

    Objective-C

    - (void)qmui_invalidateHeightForKey:(id<NSCopying>)key;

    Swift

    func qmui_invalidateHeight(forKey key: NSCopying!)