views:

545

answers:

2

I've got a view when I want to use UIPickerView but my application supports also UITabBar. I want to display UIPickerView in the same spot where keyboard pops up but the problem is that when I do that tab bar buttons are above picker and only half of it is beign displayed. Is is possible to temporary disable tab bar before I draw a picker and restore it when picker will disappear?

+1  A: 

Can you show us how you're displaying the UIPickerView? I'll assume you're adding it as a subview to a view controller that is shown from a tab bar, and setting its frame so that it is positioned the same as the keyboard.

In that case, try adding the UIPickerView as a subview to the window, rather than the view controller's view:

[[[UIApplication sharedApplication] keyWindow] addSubview:myPickerView];

This should show it above all other views.

One likely caveat is that if a keyboard needs to be shown at any time while your pickerview is in place, the keyboard will show above your pickerview, hiding it until the keyboard is dismissed again.

Jasarien
Yes, I'm adding UIPickerView as a subview to the windows. I'll try your solution.
RaYell
+1  A: 

What if you called

myTabBarController.tabBar.hidden = YES;

before showing this picker view?

marcc
How do I get `myTabBarController` in my custom view when it's defined in MainWindow nib?
RaYell
from your controller, it's self.tabBarController.tabBar; see http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/tabBarController
Sixten Otto
This hids the tabbar but it leaves an empty white rectangle in its place.
RaYell
Check out my question from 2 weeks ago: http://stackoverflow.com/questions/2078507/subclass-of-uitabbarcontroller-replaced-the-tabbar-and-have-a-display-issue
marcc