我正在使用Storyboard
开发我的应用程序,并且想要从一个视图传递数据到另一个视图。
我没有使用segues,而是使用instantiateViewControllerWithIdentifier
。在这种情况下,我从我的第一个TableViewController
实例化到一个NavigationController
,因为我需要第二个TableViewController
中的导航。现在我想根据点击的行来从我的第一个TableviewController
传递数据到我的第二个TableviewController
。在这种情况下, newTopViewController
将是我的NavigationController
,但我的问题是如何将数据从firstTableViewController
传递到secondTableviewController
。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *identifier = [NSString stringWithFormat:@"%@Top", [menuArray objectAtIndex:indexPath.row]];
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
}
instantiateViewControllerWithIdentifier:
从Storyboard中加载一个UINavigationController
。在导航控制器内部有一个表视图控制器。请注意,我没有使用segue,如何将数据传递给表视图控制器并显示导航控制器?” 是这样吗? - Carl Veazey