开发者

iphone - table with multiple selections

When you have multiple selections enabled for a table and select some cells, the selected cell have a red checkmark on the LEFT side. (see picture) Don't mistake with the right side checkmark.

I have this in place

-(UITableViewCellEditingStyle)tableView:(UITableView*)tableView editingStyleForRowAtIndexPath:(NSIndexPath*)indexPath {

    return UITableViewCellAccessoryCheckmark;
}

Everything is fine. When I tap a cell a red 开发者_如何学运维check appears on the LEFT side.

At some point I have to iterate thru the table to discover which cells have this left checkmark.

As far as I tested this is not an accessoryType or a editingStyle. At least in my tests no cell could be detected as selected testing for these properties.

thanks

iphone - table with multiple selections


I learned that it's not a good idea to rely on selections of cells. When a cell moves out of the view, the UITableView usually forgets about it. What I did was to create an NSMutableArray full of BOOL s and each time a cell is selected or deselected, I change the value at the right index. When I need the selected cells, I can simply use my array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜