Hi there!!!
I do not have a lot of coding experience...so I need some help please!!
In the following code, in a UITableView I wanted to put checkmarks, so that when a cell is touched, a checkmark appeared in that cell. This works fine, but when I tap a cell, 11 rows down, a cell is checkmarked, without tapping it... Does anyone can help me I apreciate it a lot!!
Code:
- (void)tableView:(UITableView *)theTableView
didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath {
[theTableView deselectRowAtIndexPath:[theTableView indexPathForSelectedRow] animated:NO];
UITableViewCell *cell = [theTableView cellForRowAtIndexPath:newIndexPath];
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
// Reflect selection in data model
} else if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
// Reflect deselection in data model
}
}