你好,我有两个故事板。让我们称他们为storyboard1和storyboard2。在没有赛格的故事板之间传递数据
我想将storyboard1的数据传递给storyboard2,这里是我的代码。
在storyboard1:
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"IndicesDetail" bundle:nil];
DataIntegrationIndexDetailViewController *cl = (DataIntegrationIndexDetailViewController *)[sb instantiateViewControllerWithIdentifier:@"indicesDetail"];
cl.transitioningDelegate = self;
[self presentViewController:cl animated:YES completion:nil];
和storyboard2,我所谓的价值是这样的:
NSLog(@"sel index:%@",_delegate.selectedIndexCode);
我得到的结果为空。
我也尝试这样的,在storyboard1:
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"IndicesDetail" bundle:nil];
DataIntegrationIndexDetailViewController *cl = (DataIntegrationIndexDetailViewController *)[sb instantiateViewControllerWithIdentifier:@"indicesDetail"];
cl.selectedIndex = @"test";
[self presentViewController:cl animated:YES completion:nil];
但它给我一个错误。
那么我如何将数据从一个故事板传递到另一个故事板?
我的方法是使用一个应用程序模型类保持“共享应用程序信息”。这可以使用单例实例进行。 – Floydian