第十三篇、OC_UICollectionView的基本配置
2024-09-02 04:41:36
- (UICollectionView *) categoryCollectionView
{
if (! _categoryCollectionView) { // 创建布局
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
layout.itemSize = CGSizeMake(KItemWidth,KItemHeight);
layout.minimumInteritemSpacing = KSpace;
layout.minimumLineSpacing = KSpace;
layout.headerReferenceSize = CGSizeMake(KScreentW,KProductHeaderCellH); _categoryCollectionView = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout];
_categoryCollectionView.dataSource = self;
_categoryCollectionView.delegate = self;
_categoryCollectionView.backgroundColor = [UIColor colorWithRed:234.0/ green:234.0/ blue:234.0/ alpha:]; // 注册
[_categoryCollectionView registerNib:[UINib nibWithNibName:@"GFBCategoryCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:KProductCell];
[_categoryCollectionView registerNib:[UINib nibWithNibName:@"GFBCategoryCollectionReusableView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KProductHeaderCell]; // 设置内边距,添加轮播图
_categoryCollectionView.contentInset = UIEdgeInsetsMake(KBanerH, , , ); }
return _categoryCollectionView;
}
最新文章
- SQL Server 2016白皮书
- Hadoop学习笔记—11.MapReduce中的排序和分组
- 单例模式:Instance
- ServiceManager: Permmission failure: android.permission.RECORD_AUDIO
- 数据库IO简介
- PHP 实现 一致性哈希 算法(转的)
- 小心指针被delete两次
- HTTP请求头host解析
- Colour your Log4Net events in your RichTextBox zz
- (一)chrome扩展 - API小记
- Flink Program Guide (8) -- Working with State :Fault Tolerance(DataStream API编程指导 -- For Java)
- Linux命令对应的全称解释(转)
- php连接mysql(linux下)
- alpha冲刺1/10
- 附近有什么?8款可以查周边的App
- TensorFlow 官方文档中文版 --技术文档
- #define 和typedef
- 音频播放时出现 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
- 【洛谷】P1247 取火柴游戏(Nim)
- CentOS 7 调整 home分区 扩大 root分区