0
我想將默認頁眉設置爲UICollectionView
。我使用下面的代碼,它崩潰了。如何將頁眉設置爲UICollectionView
在-viewDidLoad
[feedcollectionview registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"cell"];
在-viewForSupplementaryElementOfKind
UICollectionReusableView *reusableview = nil;
if (kind == UICollectionElementKindSectionHeader) {
UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView" forIndexPath:indexPath];
[headerView setBackgroundColor:[UIColor redColor]];
reusableview=headerView;
謝謝
在viewDidLoad中標識