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

StackOverflow https://stackoverflow.com/questions/21855694

Question

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.

Was it helpful?

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.

OTHER TIPS

Main thing you need to understand is UINavigationController and UITabbarController are UIViewControllers. So you can put UINavigationController in UITabbarController or even UITabbarController in UITabbarController.

In your case you can put you splash screen in UINavigationController with hidden UINavigationBar, than push your UITabbarController into it.

For the header you can customize UINavigationBar or you can put the view of your UITabbarController as Subview of custom UIViewController with needed frame and put you header above it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top