OGeek|极客世界-中国程序员成长平台

标题: ios - 从 UITableviewcell 移动到 ViewController 并使用 Storyboard返回 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 23:34
标题: ios - 从 UITableviewcell 移动到 ViewController 并使用 Storyboard返回

我有一个 View Controller ,里面有多个 tableviewcells。我想使用 Storyboard 从一个 tableviewcell 移动到另一个 viewcontroller。我有一个用于 View Controller 的导航 Controller 。我真的没有找到解决这个问题的方法。



Best Answer-推荐答案


你应该实现 didSelectRowAtIndexPath 委托(delegate),然后是一些用于移动到另一个 View Controller 的逻辑。

@interface ViewController()<UITableViewDelegate>

...

- (void)tableViewUITableView *)tableView didSelectRowAtIndexPathNSIndexPath *)indexPath {

    AnotherViewControllerClass *vc = [[UIStoryboard storyboardWithName"StoryboardNameOfAnotherViewController" bundle:nil] instantiateViewControllerWithIdentifier"AnotherViewControllerIdentifier"];

    [self.navigationController pushViewController:vc animated:YES];
}

关于ios - 从 UITableviewcell 移动到 ViewController 并使用 Storyboard返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41562075/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4