【问题标题】:how to get cell's text on the nextview when click on a cell in uitableview单击uitableview中的单元格时如何在nextview上获取单元格的文本
【发布时间】:2009-06-12 07:02:12
【问题描述】:

我想将所选 uitablevicell 中的文本显示到下一个视图的导航栏标题。有什么想法吗?

【问题讨论】:

    标签: iphone objective-c xcode uitableview uinavigationbar


    【解决方案1】:

    在您的委托方法中:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]
    nextViewController.title = cell.text;
    [self.navigationController pushViewController:nextViewController animated:YES];
    
    }
    

    【讨论】:

    • 在上面给定的代码中需要更正:该行应该读作 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath] 而不是 indexpath.row。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多