سؤال

The code about present another independent storyboard as follows:

- (IBAction)action:(id)sender {

UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil];
UIViewController *firstVC = [secondStoryboard instantiateViewControllerWithIdentifier:@"22"];
[self.navigationController presentViewController:firstVC animated:YES completion:nil];
}

If my storyboard like follow contain a UITabBarController the Pesentbutton with function -(IBAction)action:(id)sender; can't present another independent storyboard.

enter image description here

If my storyboard like follow contain a UINavigationController the Pesentbutton with function -(IBAction)action:(id)sender; presents another independent storyboard as expected.

enter image description here

Who can tell me the reason?More thanks!

هل كانت مفيدة؟

المحلول

Because in the first case self.navigationController is nil... Since no navigation controller is present. Try presenting from self or self.tabBarController

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top