- layout 布局子控件
- 自定义的cell中实现
- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
UICollectionViewLayoutAttributes *attributes = [super preferredLayoutAttributesFittingAttributes:layoutAttributes];
CGRect rect = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 0);
[self.contentView layoutIfNeeded];
//imageView 是cell中 最后面的控件
CGFloat maxH = CGRectGetMaxY(self.imageView.frame);
rect.size.height = maxH+10;
attributes.frame = rect;
return attributes;
}
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END