UICollectionView 多选显示问题

这几天想做个本地相册选择器,想用UICollectionView排列出照片,点击就选择照片,支持多选,再点击也可以取消选择,这几个属性collectionview都有,所以很简单,但我想要一个选上就很炫酷的标志,其实就是在collectionviewcell上加个确定图,但是怎么加都加不对,因为它的重用机制,只要我强行去加的话,其他重用了此cell也会加上,查了半天,在cell里面有这样的一个函数 
// Cells become highlighted when the user touches them.
// The selected state is toggled when the user lifts up from a highlighted cell.
// Override these methods to provide custom UI for a selected or highlighted state.
// The collection view may call the setters inside an animation block.
@property (nonatomic, getter=isSelected) BOOL selected;
@property (nonatomic, getter=isHighlighted) BOOL highlighted;
这个就是说可以自定义界面UI,实际用的时候
- (void)setSelected:(BOOL)selected {
    [super setSelected:selected];
    if (!selected) {
        selectBt.hidden = NO;
    }
    else
        selectBt.hidden = YES;
    
}

变成了这个样。
posted @ 2016-03-18 10:41  赫凯  阅读(30)  评论(0)    收藏  举报