0

I am having Loginview controller,I have created it with Xib and i want to push mainstoryboard on clicking loginbutton.

LoginViewController *lObjloginview = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
UINavigationController *lObjtempview = [[UINavigationController alloc] initWithRootViewController:lObjloginview];
self.window.rootViewController = lObjtempview;
[self.window makeKeyAndVisible];

This will add loginview from xib.but after pressing loginbutton I want to load storyboard.Can anyone help me in pushing mainstoryboard which has tabbar controller inside mainstoryboard to link xib.

NHS
  • 409
  • 2
  • 7

1 Answers1

1

Load the initial view controller from the storyboard and present it

UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController * initialVC = [storyboard instantiateInitialViewController];
self.window.rootViewController = initialVC;

If you know a priori the class you're instantiating

UITabBarController * initialVC = (UITabBarController *)[storyboard instantiateInitialViewController];
Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
  • In this If I want to set some properties of Second tabbar controller in storyboard then how will I have do that?? – NHS Aug 27 '13 at 09:00
  • 1
    you can instantiate any view controller from the storyboard using `[storyboard instantiateViewControllerWithIdentifier:@"Whatever"]`. More info: http://stackoverflow.com/questions/8186375/storyboard-refer-to-viewcontroller-in-appdelegate – Gabriele Petronella Aug 27 '13 at 09:02
  • How to access the [initialVC objectAtIndex:1] so that i want to set some properties. – NHS Aug 27 '13 at 09:04
  • Here initialVC is a tabbarcontroller for me – NHS Aug 27 '13 at 09:05
  • 1
    Just cast it to a `UITabBarController`, see my updated answer – Gabriele Petronella Aug 27 '13 at 09:06