UICollectionView 实现多\单选
2023-06-19 本文已影响0人
青柠盛夏
UICollectionView 在实际开发中需要在模型Model里定义一个BOO值,来标记是否选中,根据选中状态来切换选中状态
如@property(nonatomic,assign) BOOL selected;
模拟数据:

在cellForItemAtIndexPath 里给cell 的model赋值 cell.model = model;
多选:

单选:

UICollectionView 在实际开发中需要在模型Model里定义一个BOO值,来标记是否选中,根据选中状态来切换选中状态
如@property(nonatomic,assign) BOOL selected;
模拟数据:
在cellForItemAtIndexPath 里给cell 的model赋值 cell.model = model;
多选:
单选: