How to get the cell.label.text values from a selected row of UITableview?

后端 未结 2 895
难免孤独
难免孤独 2021-01-22 09:51

I am new in iOS application Development and i need help on UItableview. As i am populating the table-view with json data.I am also Using Customized Tableviewcell also. I am not

2条回答
  •  既然无缘
    2021-01-22 10:06

    You may have to implement the method:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    

    which is called each time a row is selected, and inside that method:

    Simpletablecell *cell = (Simpletablecell *)[tableView cellForRowAtIndexPath:indexpath];
    lbluid.text = cell.lbl4.text;
    

    The method:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    

    is called the the table view is loading it's cells to be displayed, which is why you lbluid.text is only changing when the table view is scrolled.

提交回复
热议问题