测试已测试 | ✗ |
语言编程语言 | Obj-CObjective C |
许可证 | MIT |
发布上次发布 | 2016年3月 |
由 August rush 维护。
Storyboard 中的原型单元格
-registerNib:forCellReuseIdentifier
-registerClass:forCellReuseIdentifier
如果你的单元格使用自动布局,你只需要这样做
#import "UICollectionView+ARDynamicHeightLayoutCell.h"
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [collectionView ar_sizeForCellWithIdentifier:@"DynamicHeightCell" fixedWidth:300 configuration:^(id cell) {
//configuration your cell
FeedModel *feed = self.feeds[indexPath.row];
[cell filleCellWithFeed:feed];
}];
}
#import "UICollectionView+ARDynamicHeightLayoutCell.h"
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [collectionView ar_sizeForCellWithIdentifier:@"DynamicHeightCell" fixedHeight:400 configuration:^(id cell) {
//configuration your cell
FeedModel *feed = self.feeds[indexPath.row];
[cell filleCellWithFeed:feed];
}
}
#import "UICollectionView+ARDynamicHeightLayoutCell.h"
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [collectionView ar_sizeForCellWithIdentifier:@"DynamicHeightCell" configuration:^(id cell) {
//configuration your cell
FeedModel *feed = self.feeds[indexPath.row];
[cell filleCellWithFeed:feed];
}
}
pod 'UICollectionView-ARDynamicHeightLayoutCell', :git => 'https://github.com/AugustRush/UICollectionView-ARDynamicHeightLayoutCell.git'
v1.0
为单元格高度添加缓存,提高效率(自动失效)
v0.7
支持 Storyboard 原型单元格
v0.6
修正了高度计算错误并支持动态大小单元格
v0.5
支持计算 UICollectionView Cell 的大小