0
我有一个UITableView,我想用它来允许多选。我将大部分功能汇集在一起,但遇到一个小问题。UITableView多选
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Selected");
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
if ([selectedCell accessoryType] == UITableViewCellAccessoryNone) {
[selectedCell setBackgroundColor:[UIColor grayColor]];
[selectedCell setAccessoryType:UITableViewCellAccessoryCheckmark];
[[selectedCell textLabel] setTextColor:[UIColor whiteColor]];
} else {
[selectedCell setAccessoryType:UITableViewCellAccessoryNone];
[selectedCell setBackgroundColor:[UIColor clearColor]];
[[selectedCell textLabel] setTextColor:[UIColor blackColor]];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
这是我使用,以保持选定单元格中的代码,但是当用户点击该单元格,在aaccessory视图变成白色,然后变成回蓝。
对于我来说,让配件视图保持白色的最佳方式是什么?
感谢