UICollectionViewCell 布局
来源:互联网 发布:会声会影软件 编辑:程序博客网 时间:2024/05/24 06:00
//定义每个Item 的大小- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ return CGSizeMake(kImageHeight, kImageHeight);}//定义每个UICollectionView 的 margin-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{ return UIEdgeInsetsMake(0, 0, 0, 0);}- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{ CGFloat width = collectionView.frame.size.width - 5*kImageHeight; return width/5.0;}
这是我将collectionview加到tableviewcell上,
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath设定没个小单元格大小,图中就是指没个小图
<pre name="code" class="objc" style="color: rgb(0, 132, 0); font-size: 11px;">-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section设定整个collection的cell行间距(上下左右边距)
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section设定collectionview中没个小单元的间距,如图中图片与图片的间距,动态计算的话,需要这三个协议都实现
0 0
- UICollectionViewCell 布局
- UICollectionViewCell
- UICollectionViewCell
- UICollectionViewCell的拖拽消失,以及布局混乱问题
- UICollectionViewCell复用
- 移动UICollectionViewCell
- UICollectionviewCell自适应label长度
- UICollectionViewCell的使用
- 设置UICollectionViewcell无间隙
- 关于UICollectionViewCell的问题
- UICollectionView 及 UICollectionViewCell 复用
- iOS 自定义UICollectionViewCell
- UICollectionViewCell 长按重排
- UICollectionViewCell的indexPath问题
- 设置UICollectionViewCell选中颜色
- Swift之自定义UICollectionViewCell
- 点击UICollectionViewCell上的UIButton如何获取当前的UICollectionViewCell?
- UICollectionViewCell上显示编辑菜单
- LeetCode: Remove Duplicates from Sorted Array II(在排序数组中删除重复元素)
- faac源码分析之faacEncOpen
- TextField类
- Android Service中判断系统全屏
- 【链表】续写上次的19功能链表
- UICollectionViewCell 布局
- Android中的设计模式
- Android SDK开发包国内下载地址
- faac源码分析之解码参数配置
- Protocol Buffer介绍(Java)
- RDIFramework.NET ━ 9.2 员工管理 ━ Web部分
- 我的学习之旅(40) sched.c
- 电采暖wifi互联网温控器手机远程控制
- POJ 3295 Tautology(构造法)