How to know the UITableview row number

前端 未结 10 1837
粉色の甜心
粉色の甜心 2020-11-22 11:28

I have a UITableViewCell with UISwitch as accessoryview of each cell. When I change the value of the switch in a cell, how can I know in which row

10条回答
  •  温柔的废话
    2020-11-22 11:44

    i dont know about the multiple sections but i can give you for the one section...

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
    NSInteger index=indexPath.row;
    NSString *string=[[NSString alloc]initWithFormat:@"%ld",(long)index];
    }
    

    from this you can get the row number and you can save it to the string....

提交回复
热议问题