Wednesday, September 4, 2013

Get count of row Selected in UITableView -- IOS

Create NSmutalble Array in your .h file -
NSMutableArray *SelectedRowCountArr;

in .m File :-
- (void)viewDidLoad
{
       SelectedRowCountArr = [[NSMutableArray alloc]init];
   }

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 if(![SelectedRowCountArr containsObject:indexPath])
    {
        [SelectedRowCountArr addObject:indexPath];

    }else{
    [SelectedRowCountArr removeObject:indexPath];

    }

    NSLog(@"SelectedRowCountArr.count...%d",SelectedRowCountArr.count);
}

No comments:

Post a Comment