セルが選択されている (チェックされている) 場合、アクセサリ タイプが「CheckMark」に設定されている Uitableview があります。セルの内容を配列に追加し、チェックされていない場合は配列から同じものを削除します。
このコードを に追加しましたtableView:didSelectRowAtIndexPath:
:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
NSIndexPath *tableSelection = [listingSet indexPathForSelectedRow];
if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
[listingSet deselectRowAtIndexPath:tableSelection animated:YES];
}
else {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
ID = [NSString stringWithFormat:@"%@",[[ParsedData valueForKey:@"ID"]objectAtIndex:indexPath.row]];
NSLog(@"++++++IDSSS %@",ID);
NSString *titlename = [NSString stringWithFormat:@"%@.%@",[[ParsedData valueForKey:@"UserFileName"]objectAtIndex:indexPath.row],[[ParsedData valueForKey:@"fileExtension"]objectAtIndex:indexPath.row]];
[Selectedfiles addObject:ID];
[Selectedfiles retain];
NSLog(@"++++++Titlesss %@",Selectedfiles);
[listingSet deselectRowAtIndexPath:tableSelection animated:YES];
}
}