-1

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • I have already visited following links: http://stackoverflow.com/questions/2029102/loading-a-welcome-screensplash-screen-before-tabbarcontroller http://stackoverflow.com/questions/5514584/splash-screen-before-tabbarcontroller but don't know how to implement it. :( – Niranjan Balkrishna Prajapati Feb 18 '14 at 13:45

2 Answers2

1

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.

jrturton
  • 118,105
  • 32
  • 252
  • 268
  • Thanks for reply can you please tell me whether i am right or not. So when the csv parsing is completed i should create a function in splashscreen viewcontroller and initialise tabbarcontroller in that function? – Niranjan Balkrishna Prajapati Feb 18 '14 at 14:04
  • That would work, yes, or you could use a notification and let the app delegate handle it – jrturton Feb 18 '14 at 14:06
  • If i create a function in splashscreenviewcontroller and initialise tabbarcontroller in that than how to set window.rootviewcontroller as this is available in appdelegate class only i will not be able to access it in splashscreenvideocontroller – Niranjan Balkrishna Prajapati Feb 18 '14 at 14:15
  • **...or you could use a notification and let the app delegate handle it** – jrturton Feb 18 '14 at 14:25
  • sorry jrturton for harassing you. But can you let me know how to use notification as i am not aware of it. – Niranjan Balkrishna Prajapati Feb 18 '14 at 14:29
  • Sorry, but if you've only just heard of it, I can't explain it to you in comments to an answer on an unrelated question. Do some reading, try some things out, and if you still have a problem, ask another question. – jrturton Feb 18 '14 at 14:57
0

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.

ad1Dima
  • 3,185
  • 2
  • 26
  • 37