0

I have an application with a UITabBarController at its top level. I track which tab a user is on and store it so that when they reopen the application they are on the tab they were on when it was closed. So there is no default tab when the app starts up.

I have a modal screen that shows first every time the app starts. It doesn't matter which tab was saved, the user is always presented with this view.

Where should this modal view be presented from? The logical thing would be to have the UITabBarController present it as it is the rootViewController, but Apple discourages subclassing UITabBarController. Another approach would be to have a UIViewController as the rootViewController that would handle the presentation, but Apple insist that UITabBarController should be the rootViewController.

So how should I deal with this?

Undistraction
  • 42,754
  • 56
  • 195
  • 331
  • Make a function in one common class which presents the modal view you want and then put it in viewDidAppear of root viewcontrollers for all the tabs you have. Hope you get it. Let me know if you need more help. Thanks – Parth Bhatt May 10 '12 at 16:04

1 Answers1

3

If you start with a window-based application  and first set your viewController as rootViewController and then, after you're done with this viewController, set the tabBarController as rootViewController, i think you don't have problems.

Mat
  • 7,613
  • 4
  • 40
  • 56
  • That's an interesting idea. So have a temporary VC that manages presenting a Modal view at startup then replace it with the UItabBarController? I wonder how smooth the switch would be though. – Undistraction May 10 '12 at 16:13
  • Yes, exactly; i've done this in several apps for the login. You can put some delay/animation to accomplish a nice transition effect. – Mat May 10 '12 at 16:42