tags:

views:

442

answers:

2

Hello,

I have an application where I have a TabBarController with 4 tabs init, When you click the button on the front view(Which is the first tab), a view is uploaded in the navigation view. Now I want to use the UIImagePicker Controller to take a picture and save it in this second view. When I do so the modal Controller is loaded but the bottom bar of that controller which has buttons Choose and cancel are get covered by the tabbar.

I tried using

viewController.hidesBottomBarWhenPushed = YES;

But it dont hide the tabBar.

Is there any way to hide the tabBar or load the modalController view to select the picture over the tabBar.

A: 

Because you are pushing the view onto the Navigation stack (I presume by using [self pushViewController:etc]) it's all happening inside the Navigation controller and so the tab bar will always appear on top.

What you need to do is to add it on top of the window which is holding the Navigation controller. Assuming you have a single Navigation controller owned by the app delegate, your code might be something like this:

MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window addSubview:myOtherViewController.view];

Hope that helps!

h4xxr
A: 

@h4xxr: I think you have the right idea here, but with the modalViewController, it's not pushViewController, it's presentModalViewController.

@rkbang, I would try doing that at the window level, and also at the tab-bar level to see if that can work.

Another alternative would be to create a public method in a custom UITabBarController called Hide and then just call that after presenting the modal view.

TahoeWolverine
If you write a method hide what will be the code for it. Like how can we hide the tabBarItem.
rkb
The code you already have...I've seen it work, so the question is just putting it in the right place (in the right custom class in your view hierarchy). Looks like you solved the problem though.
TahoeWolverine
Quite right Tahoe, presentModalViewController. Was focusing on the fact he was doing in the wrong place!...
h4xxr