CollectionView-BMDynamicLayout 1.0.4

CollectionView-BMDynamicLayout 1.0.4

idhong 维护。



  • liangdahong

UICollectionView-DynamicLayout

演示

介绍

  • 🖖自动布局单元格模板用于自动计算和缓存 UICollectionView 大小框架,仅适用于通过 xib 创建的单元格。

CocoaPods

pod 'UICollectionView-DynamicLayout'
pod install
#import "UICollectionView+DynamicLayout.h"

使用说明

如果你的单元格使用自动布局,你只需这样做

Xib创建单元格

如果 max x view 或者 max y view 固定

@property (nonatomic, assign) IBInspectable BOOL bm_maxXViewFixed; ///< maxX view whether fixed, default NO.
@property (nonatomic, assign) IBInspectable BOOL bm_maxYViewFixed; ///< maxY view whether fixed, default NO.

单元格固定宽度

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                         cellMaxWidth:(CGFloat)width
                                  key:(NSString *)key
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                         cellMaxWidth:(CGFloat)width
                            indexPath:(NSIndexPath *)indexPath
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

单元格固定高度

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                        cellMaxHeight:(CGFloat)height
                                  key:(NSString *)key
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                        cellMaxHeight:(CGFloat)height
                            indexPath:(NSIndexPath *)indexPath
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

单元格固定大小

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                          cellMaxSize:(CGSize)size
                                  key:(NSString *)key
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                          cellMaxSize:(CGSize)size
                            indexPath:(NSIndexPath *)indexPath
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

单元格动态大小

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                                  key:(NSString *)key
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
                            indexPath:(NSIndexPath *)indexPath
                        configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;

许可

CocoaPods-DynamicLayout 以 MIT 许可证发布。有关详情,请参阅 LICENSE 文件。