ios - 使用 Storyboard从 UITableviewcell 移动到 ViewController 并返回

标签 ios objective-c uistoryboard

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

最佳答案

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

@interface ViewController()<UITableViewDelegate>

...

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

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

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

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

相关文章:

iphone - 将 iOS 应用程序请求签名到服务器以防止垃圾邮件

objective-c - NSClassFromString 返回一个没有正确响应 isSubClassOfClass 的 Class 对象

ios - 自定义 UINavigationItem 类 - 标题依赖于 Active UIStoryboard

ios - 数组中的 UILabels 未显示在 ViewController 上

ios - 从 Parse localDataStore 查询对象

ios - 在 Objective-c 中用什么代替 "id"?

objective-c - 如何降低 iPhone objective-c 中的图像质量/尺寸?

ios7 - UISplitViewController iOS 7 向后兼容性

ios - Xcode,在哪里分配segue标识符

ios - 3D Touch Quick Action 4 项目限制?