单击uitableview中的单元格时如何在下一个视图中获取单元格的文本

时间:2021-08-10 22:20:18

I want to show the text from the uitablevicell selected to the nextview's navigationbar title. Any idea regarding this?

我想显示从所选的uitablevicell到nextview的导航栏标题的文本。对此有何看法?

1 个解决方案

#1


In your delegate method:

在您的委托方法中:

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

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]
nextViewController.title = cell.text;
[self.navigationController pushViewController:nextViewController animated:YES];

}

#1


In your delegate method:

在您的委托方法中:

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

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]
nextViewController.title = cell.text;
[self.navigationController pushViewController:nextViewController animated:YES];

}