Question

I am developing an iPad application.

My application is a UITabBar based application with 5 tabs. Now my requirement is to show a view controller outside these 5 tabs.

Explanation:

For example I have 5 tabs, A, B, C, D, E. A is selected by default.

Now I have to show a new view controller say, F. But when I show that view none of the tabbar item should be selected.

What I have tried:

I created a UINavigationController as 6th tab. Now its not visible at the bottom and it nearly produces the effect I needed but have following two problems.

  1. Tab bar items are not center aligned (Due to one hidden tab at right)
  2. User can tab that hidden tab

Update:

Actually I am following an already developed application and I am sure its possible. Scenario is I have 5 tabs that user can access without login. On navigation bar I have login button. When user is logged in I have a menu button in my navigation bar. Now tapping menu will show a view that doesn't belongs any of the tabs below. And that's why I need implementation explained above.

Was it helpful?

Solution

Work around I used to achieve above effect.

When I need to push my new UIViewController for which I want to deselect all of the UITabBarItem of my tabBarController, first I do the following things

  1. Set selected index of tabBarController to last tab.
  2. Set deselected image in last UITabBarItem
  3. Get navigation controller of last tab and pop it to RootViewController.
  4. Now push my new controller
  5. Hide back navigation button in my view controller.

Hence I am able to show a Viewcontroller keeping user experience as current view is not in any of the tabs.

Thanx.

OTHER TIPS

Sounds like a job for a modal view controller, i.e. one that's displayed in response to some user interaction other than selecting it via the tab bar.

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