佚名通过本文主要向大家介绍了collectionview,ios collectionview,collectionviewsource,pagedcollectionview,头部比例不符合要求等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 怎样在collectionView头部添加轮播图,要求能随collectionView滚动
描述:
解决方案1:
描述:
是否一定要自定义layout?
解决方案1:
O(∩_∩)O 你把轮播图那个View
[self.collectionView registerClass:[lunboView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:findCollectionViewSectionHeaderIdentifier];
其中lunboView继承与UICollectionReusableView
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
lunboView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:findCollectionViewSectionHeaderIdentifier forIndexPath:indexPath];
}
你把你的轮播View加到新建的那个View中就行了
您可能想查找下面的文章:
- 设置UICollectionViewFlowLayout的minimumLineSpacing不起作用怎么回事?
- UITableViewCell中嵌套UICollectionView,希望前者的高度根据后者的高度而改变
- 怎么实现UICollectionView放大,并且左右可以拖动
- UICollectionView的头部无法使用pushViewController跳转,如何解决?
- 怎么用collectionView做一个横向无限循环滚动,而滚动后的item最终可以回到屏幕中间。
- UICollectionView滚动到指定cell的机制问题
- ios写日历时collectionview的cell的复用问题
- uicollectionviewcell自适应问题
- 如何让UICollectionView第一组头部显示图片和按钮第二组数据的头部显示其他的标题
- 怎样用collectionView实现这种效果