关于collectionView 的头视图
1. 头视图大小
layout.headerReferenceSize = CGSizeMake(375, 200);
// 注册头视图
[self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"headerReuse"];
// 设置表头和区域内容
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"headerReuse" forIndexPath:indexPath];
headerView.backgroundColor = [UIColor cyanColor];
headerView.userInteractionEnabled = YES;
return headerView;
}
posted on 2015-10-14 19:22 在指尖跳舞的大狮子 阅读(1087) 评论(0) 编辑 收藏 举报