objective-cios7uiviewcontrolleruitabbarcontrollerios-universal-app

switching to uitabbarcontroller (having views with customised header) after custom splashscreen (UIViewController) is loaded without storyboard


I am making my application without storyboard.

Where I have a custom splashscreen which is made in uiviewcontroller and I am parsing some csv files while splash screen is loading which I have implemented.

As the parsing is completed I want to make a tabbarcontroller which has 4 uiviewcontroller associated with tabbar buttons and all the uiviewcontroller will have a custom header which will be common throughout. The custom header will have label, some buttons which is implemented. The 4 UIviewcontroller associated with tabbar buttons are also implemented.

But the problem I am facing is I am not able to switch from splashscreen to that main tabbarcontroller(which i am not aware how to create without storyboard and without navigation controller as I have a custom header common in all 4 views of the tabbar).

I don't want to use navigation controller as I have a custom header which I need to use.

So I want to create a tabbarcontroller without storyboard which I am not aware how to do that. And switching from splashscreen viewcontroller to tabbar default viewcontroller.

Please help me with tutorial or example code. As I have searched a lot but was not able to find solution for same.


Solution

  • So I want to create a tabbarcontroller without storyboard which I am not aware how to do that.

    UITabBarController *tabVC = [[UITabBarController alloc] init];
    tabVC.viewControllers = @[viewController1,viewController2....];
    

    Where viewController1 etc. are the view controllers that occupy each tab of the tab bar.

    And switching from splashscreen viewcontroller to tabbar default view controller.

    window.rootViewController = tabVC;
    

    Where window is your application delegate's window property.