开发者

How can i select multiple rows from table view and how to get data from that?

开发者 https://www.devze.com 2023-04-13 04:14 出处:网络
How can i select multiple rows from a table view and i need to g开发者_高级运维et that data(Cell) which were selected by the user.

How can i select multiple rows from a table view and i need to g开发者_高级运维et that data(Cell) which were selected by the user.

Thanks


You can add selected Cell's [indexPath row] to an Array. And use it later. NSMutableArray* selectedCellsArray; // iVar then somwhere in your implementation

selectedCellsArray = [[NSMutableArray alloc] init];

in your tableView didSelectRowAtIndexpath delegate method:

[selectedCellsArray addObject:[NSNumber numberWithInt:[indexPath row]]];

your array will have all of selected tableView cells indexPath row.


You can do with your logic and For every select you can change as Checkmark at the cell.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
       {
           // change this row as selected
          //add the value in an array and use tat at the end
         }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号