UICollectionView(FWDynamicLayout)
@interface UICollectionView (FWDynamicLayout)
extension UICollectionView: SkeletonViewDataSource
集合自动计算并缓存cell高度分类,最底部view的MaxY即为cell高度,自定义方案实现
如果使用系统自动尺寸,建议设置estimatedItemSize提高性能
-
手工清空尺寸缓存,用于尺寸发生变化的情况
Declaration
Objective-C
- (void)fw_clearSizeCache; -
指定indexPath设置cell尺寸缓存,设置为zero时清除缓存
Declaration
Objective-C
- (void)fw_setCellSizeCache:(CGSize)size forIndexPath:(nonnull NSIndexPath *)indexPath; -
指定key设置cell尺寸缓存,设置为zero时清除缓存
Declaration
Objective-C
- (void)fw_setCellSizeCache:(CGSize)size forKey:(nonnull id<NSCopying>)key; -
指定indexPath获取cell缓存尺寸,默认值automaticSize
Declaration
Objective-C
- (CGSize)fw_cellSizeCacheForIndexPath:(nonnull NSIndexPath *)indexPath; -
指定key获取cell缓存尺寸,默认值automaticSize
Declaration
Objective-C
- (CGSize)fw_cellSizeCacheForKey:(nonnull id<NSCopying>)key; -
指定section设置ReusableView尺寸缓存,设置为zero时清除缓存
Declaration
Objective-C
- (void)fw_setReusableViewSizeCache:(CGSize)size kind:(nonnull NSString *)kind forSection:(NSInteger)section; -
指定key设置ReusableView尺寸缓存,设置为zero时清除缓存
Declaration
Objective-C
- (void)fw_setReusableViewSizeCache:(CGSize)size kind:(nonnull NSString *)kind forKey:(nonnull id<NSCopying>)key; -
指定section获取ReusableView缓存尺寸,默认值automaticSize
Declaration
Objective-C
- (CGSize)fw_reusableViewSizeCache:(nonnull NSString *)kind forSection:(NSInteger)section; -
指定key获取ReusableView缓存尺寸,默认值automaticSize
Declaration
Objective-C
- (CGSize)fw_reusableViewSizeCache:(nonnull NSString *)kind forKey:(nonnull id<NSCopying>)key;
-
获取 Cell 需要的尺寸,内部无缓存操作
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell类
configuration布局cell句柄,内部不会拥有Block,不需要__weak
Return Value
cell尺寸
-
获取 Cell 需要的尺寸,固定宽度,内部无缓存操作
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz width:(CGFloat)width configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell类
width固定宽度
configuration布局cell句柄,内部不会拥有Block,不需要__weak
Return Value
cell尺寸
-
获取 Cell 需要的尺寸,固定高度,内部无缓存操作
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz height:(CGFloat)height configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell类
height固定高度
configuration布局cell句柄,内部不会拥有Block,不需要__weak
Return Value
cell尺寸
-
获取 Cell 需要的尺寸,内部自动处理缓存,缓存标识 indexPath
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz cacheByIndexPath:(nonnull NSIndexPath *)indexPath configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell class
indexPath使用 indexPath 做缓存标识
configuration布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 Cell 需要的尺寸,固定宽度,内部自动处理缓存,缓存标识 indexPath
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz width:(CGFloat)width cacheByIndexPath:(nonnull NSIndexPath *)indexPath configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell class
width固定宽度
indexPath使用 indexPath 做缓存标识
configuration布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 Cell 需要的尺寸,固定高度,内部自动处理缓存,缓存标识 indexPath
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz height:(CGFloat)height cacheByIndexPath:(nonnull NSIndexPath *)indexPath configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell class
height固定高度
indexPath使用 indexPath 做缓存标识
configuration布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 Cell 需要的尺寸,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell class
key使用 key 做缓存标识,如数据唯一id,对象hash等
configuration布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 Cell 需要的尺寸,固定宽度,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz width:(CGFloat)width cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell class
width固定宽度
key使用 key 做缓存标识,如数据唯一id,对象hash等
configuration布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 Cell 需要的尺寸,固定高度,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGSize)fw_sizeWithCellClass:(nonnull Class)clazz height:(CGFloat)height cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWCollectionCellConfigurationBlock)configuration;Parameters
clazzcell class
height固定高度
key使用 key 做缓存标识,如数据唯一id,对象hash等
configuration布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,内部无缓存操作
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz kind:(nonnull NSString *)kind configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
kindReusableView类型,Header 或者 Footer
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,固定宽度,内部无缓存操作
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz width:(CGFloat)width kind:(nonnull NSString *)kind configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
width固定宽度
kindReusableView类型,Header 或者 Footer
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,固定高度,内部无缓存操作
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz height:(CGFloat)height kind:(nonnull NSString *)kind configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
height固定高度
kindReusableView类型,Header 或者 Footer
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,内部自动处理缓存,缓存标识 section
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz kind:(nonnull NSString *)kind cacheBySection:(NSInteger)section configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
kindReusableView类型,Header 或者 Footer
section使用 section 做缓存标识
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,固定宽度,内部自动处理缓存,缓存标识 section
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz width:(CGFloat)width kind:(nonnull NSString *)kind cacheBySection:(NSInteger)section configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
width固定宽度
kindReusableView类型,Header 或者 Footer
section使用 section 做缓存标识
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,固定高度,内部自动处理缓存,缓存标识 section
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz height:(CGFloat)height kind:(nonnull NSString *)kind cacheBySection:(NSInteger)section configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
height固定高度
kindReusableView类型,Header 或者 Footer
section使用 section 做缓存标识
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz kind:(nonnull NSString *)kind cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
kindReusableView类型,Header 或者 Footer
key使用 key 做缓存标识,如数据唯一id,对象hash等
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,固定宽度,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz width:(CGFloat)width kind:(nonnull NSString *)kind cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
width固定宽度
kindReusableView类型,Header 或者 Footer
key使用 key 做缓存标识,如数据唯一id,对象hash等
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
获取 ReusableView 需要的尺寸,固定高度,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGSize)fw_sizeWithReusableViewClass:(nonnull Class)clazz height:(CGFloat)height kind:(nonnull NSString *)kind cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWReusableViewConfigurationBlock) configuration;Parameters
clazzReusableView class
height固定高度
kindReusableView类型,Header 或者 Footer
key使用 key 做缓存标识,如数据唯一id,对象hash等
configuration布局 ReusableView,内部不会拥有 Block,不需要 __weak
-
reloadData完成回调
Declaration
Objective-C
- (void)fw_reloadDataWithCompletion:(nullable void (^)(void))completion; -
reloadData清空尺寸缓存
Declaration
Objective-C
- (void)fw_reloadDataWithoutCache; -
reloadData禁用动画
Declaration
Objective-C
- (void)fw_reloadDataWithoutAnimation; -
reloadSections禁用动画
Declaration
Objective-C
- (void)fw_reloadSectionsWithoutAnimation:(nonnull NSIndexSet *)sections; -
reloadItems禁用动画
Declaration
Objective-C
- (void)fw_reloadItemsWithoutAnimation: (nonnull NSArray<NSIndexPath *> *)indexPaths; -
刷新高度等,不触发reload方式
Declaration
Objective-C
- (void)fw_performUpdates:(void (^_Nullable __strong)(void))updates;
-
Declaration
Swift
open func skeletonViewProvider() -> SkeletonView?
-
Undocumented
Declaration
Swift
@objc(fw_delegate) public var __fw_delegate: CollectionViewDelegate { get } -
Undocumented
Declaration
Swift
@objc(fw_collectionView) public static func __fw_collectionView() -> UICollectionView -
Undocumented
Declaration
Swift
@objc(fw_collectionView:) public static func __fw_collectionView(_ collectionViewLayout: UICollectionViewLayout) -> UICollectionView
UICollectionView(FWDynamicLayout) Category Reference