IOS:CollectionViewCell在多个单元格上显示相同的内容

时间:2015-04-20 11:43:49

标签: ios uicollectionview uicollectionviewcell

我正在构建一个IOS应用程序,我正在使用collectionviews实现Pinterest之类的布局。我必须动态计算图像高度,我已经实现了。

我的问题是,当我重新加载collectionview时,它不会更新imageview框架,它会显示nib文件中的默认框架。但是细胞的最终高度是正确的。我这样使用它:

[self.photoCollectionView registerClass:[AddImageViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
    FRGWaterfallCollectionViewLayout *cvLayout = [[FRGWaterfallCollectionViewLayout alloc] init];
    cvLayout.delegate = self;
    cvLayout.itemWidth = 145.0f;
    cvLayout.topInset = 10.0f;
    cvLayout.bottomInset = 10.0f;
    cvLayout.stickyHeader = NO;

然后在细胞功能中进行一些动态计算。我该怎么做才能做到对不对?

附上图片:

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试使用动态计算高度的initWithFrame来初始化单元格的框架。

相关问题