Skip to content

Instantly share code, notes, and snippets.

@Qiki
Created February 19, 2016 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qiki/6ff662ab35fb07e2914a to your computer and use it in GitHub Desktop.
Save Qiki/6ff662ab35fb07e2914a to your computer and use it in GitHub Desktop.
UINavigationController initWithRootViewController
So there is tricky thing (it will happen sometimes)
/*
* When set a storyboardID in a viewcontroller, and you want to show the navigation item
* you need to init NavigationController with rootviewcontoller
*/
UIViewControllers *niceVC = [shop instantiateViewControllerWithIdentifier:@"nice"];
UINavigationController *niceNav = [[UINavigationController alloc] initWithRootViewController:nice];
----------------------------------------
There is a same thing we can do it in storyboard
So we create a UIViewController in storyboard, and embbed in navigationController, set the navigationController storyboard id to "nice".
And return it, it will be a navigation controller with roote view controller with niceVC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment