UICollectionView-DynamicLayout
Demonstration
​
​
​
​
​
​
​
​
Introduction
🖖 Template auto layout cell for automatically UICollectionViewCell calculating and cache size framework, Only applicable to cells created by xib.
CocoaPods
pod 'UICollectionView-DynamicLayout'
pod install
#import "UICollectionView+DynamicLayout.h"
Usage
if your cell use autolayout , all you need just to do like this:
Xib create cell
max x view
or max y view
fixed
If @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.
Cell fixed width
- (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;
Cell fixed height
- (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;
Cell fixed size
- (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;
Cell Dynamic size
- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
key:(NSString *)key
configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;
- (CGSize)bm_sizeForCellWithCellClass:(Class)clas
indexPath:(NSIndexPath *)indexPath
configuration:(BMCollectionViewCellDynamicLayoutConfigurationBlock)configuration;
License
UICollectionView-DynamicLayout is released under the MIT license. See LICENSE for details.