/ Published in: iPhone
Only allows one table view cell to be checked.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if(_lastIndex != nil) { UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:_lastIndex]; if(oldCell.accessoryType == UITableViewCellAccessoryCheckmark) { oldCell.accessoryType = UITableViewCellAccessoryNone; } } UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath]; if(newCell.accessoryType == UITableViewCellAccessoryNone) { newCell.accessoryType = UITableViewCellAccessoryCheckmark; } _lastIndex = indexPath; [tableView deselectRowAtIndexPath:indexPath animated:YES]; }