- 父类是UICollectionReusableView
- UICollectionViewCell没有独有的方法
- UICollectionViewCell是空的,需要自定义子控件用于展示
UICollectionViewCell所有属性
// contentView,用于添加子控件
[cell.contentView addSubview:view];
cell.selected = NO; //是否选中
cell.highlighted = NO; //是否高亮
// 背景控件
cell.backgroundView = [[UIView alloc] init];
cell.selectedBackgroundView = [[UIView alloc] init];
UICollectionViewCell的获取
- 可参考UITableView中
UITableView的内容->cell的获取
,只是UICollectionViewCell不能通过alloc init
创建
UICollectionViewCell的contentView
- 意义与UITableViewCell的contentView一样是用于存在需要显示的子控件,方便管理
- 不同的是UITableViewCell的contentView是定制了的,而UICollectionViewCell的contentView是空白的,需要手动定制
UICollectionViewCell的重用原理
- 原理与UITableViewCell的重用原理一致,所以必须设置重用标识。