iPhone故事板以编程方式呈现模型视图

时间:2012-10-18 06:45:33

标签: iphone ios uistoryboard uistoryboardsegue

使用此故事板概念开发iphone应用程序。

在这里,我使用这个故事板完成了初始视图。

这里我在rootviewcontroller中以编程方式创建了一个按钮,用户单击此按钮我应该呈现另一个视图控制器让我们说root2ViewController。我使用下面的代码,目前的视图,但它没有呈现任何东西,它说像标识符未找到。任何解决方案和想法将不胜感激。

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                     bundle:[NSBundle mainBundle]];
UIViewController *root2ViewController = [storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
[root2ViewController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:root2ViewController animated:animation completion:nil];

2 个答案:

答案 0 :(得分:1)

在故事板的检查器窗口中,您需要设置视图控制器的故事板标识符

答案 1 :(得分:0)

我发现解决方案在下面调用这个方法是有效的。

[self performSegueWithIdentifier: @"FindMyClinic" sender: self];
相关问题