uicollectionview 的头怎么加,不是section的头

uicollectionview 的头怎么加,不是section的头,除了用tableview代替还有什么方法啊

你可以设置两个section。然后第一个section来做你的header的处理。第二个section显示数据

1.手动写一个view 贴在collectionview 基类的view上,就可以实现加载头文件的要求,好处是,view是固定在view的上部不随collectionviewCell的上下滑动而消失;
2.用scrowview 加载上view(自定义头)和collectionview,这样可以实现collectionCell滑动头view消失效果

1.手动写一个view 贴在collectionview 基类的view上,就可以实现加载头文件的要求,好处是,view是固定在view的上部不随collectionviewCell的上下滑动而消失;
2.用scrowview 加载上view(自定义头)和collectionview,这样可以实现collectionCell滑动头view消失效果

除了section。还有一个HeadView

在创建 collectionview
[self.CollView registerNib:[UINib nibWithNibName:@"" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@""];
然后在下方代理方法实现创建头视图
//头视图,作者信息

  • (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{};

只给第一组的section高度 其他不想要头view的高度设零