【发布时间】:2016-07-16 09:19:57
【问题描述】:
我使用自动布局实现了 UICollection 视图单元。它工作正常。
但我的单元格高度是动态的,因此单元格应该根据约束集更改其高度。
但在任何情况下高度都不会改变。
我的代码
- (void)viewDidLoad {
[super viewDidLoad];
UICollectionViewFlowLayout *flowlayout = (UICollectionViewFlowLayout*)_col.collectionViewLayout;
flowlayout.estimatedItemSize = CGSizeMake(self.view.frame.size.width - 30, 600);
}
-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
FirstCell *cell = [_col dequeueReusableCellWithReuseIdentifier:@"FirstCell" forIndexPath:indexPath];
return cell;
}
故事板
模拟器
所有标签都是多行的
帮我解决这个问题
感谢您的宝贵时间
【问题讨论】:
标签: ios iphone xcode uitableview uicollectionview