UITableView(FWDynamicLayout)
@interface UITableView (FWDynamicLayout)
extension UITableView: SkeletonViewDataSource
表格自动计算并缓存cell高度分类,最底部view的MaxY即为cell高度,自定义方案实现
如果使用系统自动高度,建议设置estimatedRowHeight提高性能
-
手工清空所有高度缓存,用于高度发生变化的情况
Declaration
Objective-C
- (void)fw_clearHeightCache;
-
指定indexPath设置cell高度缓存,如willDisplayCell调用,height为cell.frame.size.height,设置为0时清除缓存
Declaration
Objective-C
- (void)fw_setCellHeightCache:(CGFloat)height forIndexPath:(nonnull NSIndexPath *)indexPath;
-
指定key设置cell高度缓存,如willDisplayCell调用,height为cell.frame.size.height,设置为0时清除缓存
Declaration
Objective-C
- (void)fw_setCellHeightCache:(CGFloat)height forKey:(nonnull id<NSCopying>)key;
-
指定indexPath获取cell缓存高度,如estimatedHeightForRow调用,默认值automaticDimension
Declaration
Objective-C
- (CGFloat)fw_cellHeightCacheForIndexPath:(nonnull NSIndexPath *)indexPath;
-
指定key获取cell缓存高度,如estimatedHeightForRow调用,默认值automaticDimension
Declaration
Objective-C
- (CGFloat)fw_cellHeightCacheForKey:(nonnull id<NSCopying>)key;
-
指定section设置HeaderFooter高度缓存,如willDisplayHeaderFooter调用,height为view.frame.size.height,设置为0时清除缓存
Declaration
Objective-C
- (void)fw_setHeaderFooterHeightCache:(CGFloat)height type:(FWHeaderFooterViewType)type forSection:(NSInteger)section;
-
指定key设置HeaderFooter高度缓存,如willDisplayHeaderFooter调用,height为view.frame.size.height,设置为0时清除缓存
Declaration
Objective-C
- (void)fw_setHeaderFooterHeightCache:(CGFloat)height type:(FWHeaderFooterViewType)type forKey:(nonnull id<NSCopying>)key;
-
指定section获取HeaderFooter缓存高度,如estimatedHeightForHeaderFooter调用,默认值automaticDimension
Declaration
Objective-C
- (CGFloat)fw_headerFooterHeightCache:(FWHeaderFooterViewType)type forSection:(NSInteger)section;
-
指定key获取HeaderFooter缓存高度,如estimatedHeightForHeaderFooter调用,默认值automaticDimension
Declaration
Objective-C
- (CGFloat)fw_headerFooterHeightCache:(FWHeaderFooterViewType)type forKey:(nonnull id<NSCopying>)key;
-
获取 Cell 需要的高度,内部无缓存操作
Declaration
Objective-C
- (CGFloat)fw_heightWithCellClass:(nonnull Class)clazz configuration: (nonnull FWCellConfigurationBlock)configuration;
Parameters
clazz
cell类
configuration
布局cell句柄,内部不会拥有Block,不需要__weak
Return Value
cell高度
-
获取 Cell 需要的高度,内部自动处理缓存,缓存标识 indexPath
Declaration
Objective-C
- (CGFloat)fw_heightWithCellClass:(nonnull Class)clazz cacheByIndexPath:(nonnull NSIndexPath *)indexPath configuration: (nonnull FWCellConfigurationBlock)configuration;
Parameters
clazz
cell class
indexPath
使用 indexPath 做缓存标识
configuration
布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 Cell 需要的高度,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGFloat)fw_heightWithCellClass:(nonnull Class)clazz cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWCellConfigurationBlock)configuration;
Parameters
clazz
cell class
key
使用 key 做缓存标识,如数据唯一id,对象hash等
configuration
布局 cell,内部不会拥有 Block,不需要 __weak
-
获取 HeaderFooter 需要的高度,内部无缓存操作
Declaration
Objective-C
- (CGFloat) fw_heightWithHeaderFooterViewClass:(nonnull Class)clazz type:(FWHeaderFooterViewType)type configuration: (nonnull FWHeaderFooterViewConfigurationBlock) configuration;
Parameters
clazz
HeaderFooter class
type
HeaderFooter类型,Header 或者 Footer
configuration
布局 HeaderFooter,内部不会拥有 Block,不需要 __weak
-
获取 HeaderFooter 需要的高度,内部自动处理缓存,缓存标识 section
Declaration
Objective-C
- (CGFloat) fw_heightWithHeaderFooterViewClass:(nonnull Class)clazz type:(FWHeaderFooterViewType)type cacheBySection:(NSInteger)section configuration: (nonnull FWHeaderFooterViewConfigurationBlock) configuration;
Parameters
clazz
HeaderFooter class
type
HeaderFooter类型,Header 或者 Footer
section
使用 section 做缓存标识
configuration
布局 HeaderFooter,内部不会拥有 Block,不需要 __weak
-
获取 HeaderFooter 需要的高度,内部自动处理缓存,缓存标识 key
Declaration
Objective-C
- (CGFloat) fw_heightWithHeaderFooterViewClass:(nonnull Class)clazz type:(FWHeaderFooterViewType)type cacheByKey:(nullable id<NSCopying>)key configuration: (nonnull FWHeaderFooterViewConfigurationBlock) configuration;
Parameters
clazz
HeaderFooter class
type
HeaderFooter类型,Header 或者 Footer
key
使用 key 做缓存标识,如数据唯一id,对象hash等
configuration
布局 HeaderFooter,内部不会拥有 Block,不需要 __weak
-
是否启动高度估算布局,启用后需要子视图布局完整,无需实现heightForRow方法(iOS11默认启用,会先cellForRow再heightForRow)
Declaration
Objective-C
@property (nonatomic) BOOL fw_estimatedLayout;
-
清空Grouped样式默认多余边距,注意CGFLOAT_MIN才会生效,0不会生效
Declaration
Objective-C
- (void)fw_resetGroupedStyle;
-
设置Plain样式sectionHeader和Footer跟随滚动(不悬停),在scrollViewDidScroll:中调用即可(需先禁用内边距适应)
Declaration
Objective-C
- (void)fw_followWithHeader:(CGFloat)headerHeight footer:(CGFloat)footerHeight;
-
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;
-
reloadRows禁用动画
Declaration
Objective-C
- (void)fw_reloadRowsWithoutAnimation: (nonnull NSArray<NSIndexPath *> *)indexPaths;
-
刷新高度等,不触发reload方式
Declaration
Objective-C
- (void)fw_performUpdates:(void (^_Nullable __strong)(void))updates;
-
全局清空TableView默认多余边距
Declaration
Objective-C
+ (void)fw_resetTableStyle;
-
Declaration
Swift
open func skeletonViewProvider() -> SkeletonView?
-
Undocumented
Declaration
Swift
@objc(fw_delegate) public var __fw_delegate: TableViewDelegate { get }
-
Undocumented
Declaration
Swift
@objc(fw_tableView) public static func __fw_tableView() -> UITableView
-
Undocumented
Declaration
Swift
@objc(fw_tableView:) public static func __fw_tableView(_ style: UITableView.Style) -> UITableView