我正在使用 tableview 并且正在对 uitableview 进行多次检查。一切都很完美,我得到了正确的值,但是当我滚动表格视图时,它丢失了复选标记图像(使用默认复选标记没有自定义图像),但选定的值保留在数组中......
滚动表格视图会删除复选标记图像。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
AppDelegate *app= (AppDelegate *)[[UIApplication sharedApplication]delegate];
if([_tableView cellForRowAtIndexPath:indexPath].accessoryType == UITableViewCellAccessoryCheckmark){
NSLog(@"yes");
[placesvisitedarray removeObject:[app.nameArray objectAtIndex:indexPath.row]];
[_tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
}
else
{
NSLog(@"no");
[_tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
[placesvisitedarray addObject:[app.nameArray objectAtIndex:indexPath.row]];
}
// [_tableView reloadData];
}