单元格与九宫格的多选和单选问题

//1.collectionView单选 取消前一个选中的,就是单选 

        NSIndexPath *lastIndex = [NSIndexPath indexPathForItem:_index inSection:0];

        cell = [self cellForItemAtIndexPath:lastIndex];

        cell.imgView.hidden = YES;

    

        // 选中操作

        cell = [self cellForItemAtIndexPath:indexPath];

    

        cell.imgView.hidden = NO;

        // 保存选中的

        _index = indexPath.row;



//2. 单元格的单选

    NSIndexPath *lastIndex = [NSIndexPath indexPathForRow:_index inSection:0];

    cell = [self cellForRowAtIndexPath:lastIndex];

    // cell.accessoryType = UITableViewCellAccessoryNone;

    cell.selectedImg.hidden = YES;

    

    // 选中操作

    cell = [self  cellForRowAtIndexPath:indexPath];

    // cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

    cell.selectedImg.hidden = NO;

    // 保存选中的

    _index = indexPath.row;

    



你可能感兴趣的:(单元格与九宫格的多选和单选问题)