开发者

Hiding UITabBar when displaying UIPickerView in iPhone SDK

开发者 https://www.devze.com 2022-12-19 14:56 出处:网络
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 tha

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开发者_JS百科 I draw a picker and restore it when picker will disappear?


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.


What if you called

myTabBarController.tabBar.hidden = YES;

before showing this picker view?

0

精彩评论

暂无评论...
验证码 换一张
取 消