I currently have a UIAlertview displaying a grouped table view and have spent all week getting it to work just right, i left what should have been the easiest part till last, adding the accessories. All i want is to have the row show up as checked when it is tapped. This sounds simple enough an at first glance works fine. If i tap the cell at 0,0 it gets ticked BUT, if i then scroll down i also end up with 2,1 being ticked and 3,6 (and 0,0 gets unticked again). I have looked at This Question and tested their code on another grouped table and it works fine but made no difference to my Alert Table.
This is the code i am using
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
I see no way that this can modify more than one cell. I have put a break point there and it is only ever called one time per tap.
Cellforrowatindex method:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
NSArray *listData =[self.data objectForKey:
[self.sortedKeys objectAtIndex:[indexPath section]]];
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if(cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger Row = [indexPath row];
cell.textLabel.text = [listData objectAtIndex:Row];
return cell;
}
Thanks.