1
我有一个自定义的UICollectionViewLayout一个UICollectionView,并希望每节添加多个标题来显示不同小时不间断的。同样的事情也给了左侧的垂直小时,但在顶部和水平为我的情况下,周视图。uicollectionview自定义布局和多个头
细胞显示良好,但内容是奇怪,它看起来像细胞被重新使用和5只有1是在屏幕上有一个内容。其他4个标题只有背景颜色,没有内容。
在i滚动,有一次一些毛刺和更新只有一个小区(有时2)和该内容可以由一排被切换或放错地方。
这里是我的控制器使用的代码,viewDidLoad中
[self.epgCollectionView registerClass:[HeaderTimeReusableView class] forSupplementaryViewOfKind:EpgKindTimeRowHeader withReuseIdentifier:HeaderTimeReuseIdentifier];
同一控制器更下方:
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
UICollectionReusableView *view;
if (kind == EpgKindTimeRowHeader){
HeaderTimeReusableView *timeRowHeader = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:HeaderTimeReuseIdentifier forIndexPath:indexPath];
timeRowHeader.title.text = [NSString stringWithFormat:@"s%lir%li", (long)indexPath.section, (long)indexPath.row];
view = timeRowHeader;
}
return view;
}
我想我的自定义UICollectionViewLayout好的,因为我可以看到多标题在我想要的地方。
我的问题是:
- 是否有可能让每个节多个标头?
- 如何避免这些头文件的重用/回收的效果呢?
- 的UICollectionViewCells使用离队太多,但我们可以有每节多个单元格,为何还没有页眉/ UICollectionReusableView工作?