how to get title of of row selected in UITableview

后端 未结 5 762
孤独总比滥情好
孤独总比滥情好 2021-02-04 03:44

I have tableview with some names on each cell , how can i get that name when select row ?

i know that i have to use delegate method

-(void)tableView:(         


        
5条回答
  •  不要未来只要你来
    2021-02-04 04:28

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
        NSString *rowTitle=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;   
    }
    

    Here,

    [tableView cellForRowAtIndexPath:indexPath] gives you the selected cell and then the .textLabel.text gives you the label for that cell.

提交回复
热议问题