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);
}
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