测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2016年1月 |
从版本 v1.0 的 UICollectionView-ARDynamicHeightLayoutCell 分支出来的
Storyboard 中的原型 cell
-registerNib:forCellReuseIdentifier
-registerClass:forCellReuseIdentifier
如果您的 cell 使用自动布局,您只需这样做:
#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_Bell'