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];