给UICollectionView添加表头
来源:互联网 发布:模具分析软件 编辑:程序博客网 时间:2024/06/09 19:02
//要先设置表头高度
-(CGSize)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
{
CGSize size = {SCREEN_WIDTH,50};
return size;
}
//在表头内添加内容,需要创建一个继承collectionReusableView的类,用法类比tableViewcell
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
// 注册表头
[collectionView registerClass:[MCClassifyCollectionReusableViewclass] forSupplementaryViewOfKind:UICollectionElementKindSectionHeaderwithReuseIdentifier:@"HeaderView"];
// 初始化表头
MCClassifyCollectionReusableView *headerView = [collectionViewdequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeaderwithReuseIdentifier:@"HeaderView"forIndexPath:indexPath];
NSArray * array =@[@"1",@"2",@"3",@"4",@"5",@"6",@"7"];
headerView.hotSingerName.text = array[indexPath.section];
return headerView;
}
- 给UICollectionView添加表头
- 给UICollectionView添加表头
- 给UICollectionView添加尾部视图
- 给UICollectionView添加头视图
- 给AFNetWorking添加http表头
- 给UICollectionView 添加sectionhead 和sectionfoot
- Flex 中给Datagrid表头添加按钮
- 如何纯代码给UICollectionView添加HeaderView和FooterView
- 给DataGrid添加滚动条并固定表头
- 给DataGrid添加滚动条并固定表头
- 扩展GridView,给BoundField表头添加div (技术备份)
- winform 中 给DataGridView的表头添加CheckBox
- winform 中 给DataGridView的表头添加CheckBox
- 不完全使用(Masonry)给collectionview添加约束--通过contentoffset来给collectionview添加表头
- UICollectionView添加Footer
- UICollectionView 添加段头
- UICollectionView添加Section HeaderView
- UICollectionView 添加view
- nyoj 1070 诡异的电梯【Ⅰ】 动态规划
- 说起Android的Binder,我们都能说些什么?
- 新空间RecycleView复习
- ViewPager嵌套Fragment实现item实时更新的两种方式
- 字符串反转(reverse函数)
- 给UICollectionView添加表头
- win32-hookdll,隐藏辅助进程
- POJ - 3069 Saruman's Army 萨鲁曼的大军 贪心 重庆一中高2018级竞赛班第三次测试 2016.7.24 Problem 2
- 复合数据类型
- js的全局变量和局部变量部分讲解
- Android-Fragment 的 onActivityResult 收不到结果
- unix高级环境编程-读书笔记(1)
- Thinkphp url重写规则及wamp配置
- java中volatile关键字的含义