0

我试图呈现视图 - 控制程序在故事板呈现视图控制器编程,我使用下面提到的代码,但它不工作,不给我任何回应...在故事板

- (void)buttonPressed 
{ 
NSLog(@"called"); 

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil]; 

UINavigationController *vc = [sb instantiateViewControllerWithIdentifier:@"123"]; 

vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

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

什么我在这里失踪了吗?

+0

该代码看起来正确。你确定self.navigationController不等于零吗? – JeffN 2013-04-24 17:15:12

+0

'但它不起作用,不给我任何回应......'小心点详细点? – 2013-04-24 17:16:12

+0

我的应用程序有几个viewControllers,我有一个自定义statusBar和statusBar,我有一个自定义的“清除”按钮,从任何viewController触发此方法..我想要的是,当用户点击状态栏上,我需要我的应用程序来模式带标识符@“123”的viewController ... – DevCali 2013-04-24 17:24:47

回答

0
NSLog(@"called"); 

    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 

    UINavigationController *vc = [sb instantiateInitialViewController]; 

    vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentViewController:vc animated:YES completion:nil];