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工作?