Hiding UITabBar when displaying UIPickerView in iPhone SDK - iphone

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?

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?

Related

iPhone keyboard is not showing up

My app starts on login screen. After that I use the next code to call the TabBarViewController
DMMainScreenViewController *mainScreenController = [[[DMMainScreenViewController alloc] initWithNibName:#"DMMainScreenViewController" bundle:nil] autorelease];
self.view.window.rootViewController = mainScreenController;
[self.view.window makeKeyAndVisible];
and then I move to the last tab by clicking on that.
There are 2 UITextField and one UITextView and then when I touch any of them the keyboard is not showing up and I can not also change to another TextField/TextView but I can move to another tab.
How can I fix that?
Thanks.
keyboard to show up immediately you'll need to set the text field as the first responder using the following line:
[textField becomeFirstResponder];
but in these case of tabbarViewController, as tonklon says in his answer:
If the tabbar is needed while the keyboard is visible you could only
move the tabbar above the keyboard, or resize the tabbarcontroller, so
that the tabbar remains visible.
Are you sure you need the tabbar while the keyboard is visible?
Remember a tabbar is for changing the view. Perhaps you need to
rethink your interaction design.
Are you using IB to create your views? If so, did you remember to wire up your UITextField to the File's owner so that view knows where to send the notifications that you clicked on your TextField?

How can I restrict modalViewController in Landscape?

I am working on iPad application where I am showing some view in modalView controller.
In Landscape, when I click on UITextField for taking some input modalview controller goes up and keyboard appears.
But I have changed the height of modalViewController and I dont want the modalView goes up for keyboard. How can I do this? Any help?
In the UIViewController's code, where you move its modalViewController, check if the interface orientation is not landscape
if(([self.interfaceOrientation!=UIInterfaceOrientationLandscapeLeft])
&&([self.interfaceOrientation!=UIInterfaceOrientationLandscapeRight]))
//your code to repostion the view controlled by the modalViewController
I guess you have to use custom presentation code. You cannot change the scrollup behaviour, when the keyboard appears.
You could add a 1024*768 sized black transparent view on top of the window and then your view on top of this. But you would have to build your own borders around your view in that case. Probably there are some open-source implementations of a modal popover. You can search for that on cocoacontrols etc.

How to get the animation right: inputView from a UINavigationController's nav bar?

I have a custom UIControl subclass with a UIPickerView as inputView. When the control is tapped, it calls becomeFirstResponder and the picker view automatically slides up from the bottom of the screen, like the system keyboard. This is working great!
The problem is that I am using the custom control as the titleView of a UINavigationItem. It functions properly, but if the view controller is popped off the navigation controller stack while the picker view is visible, the animation is wonky.
What I want to happen:
everything is pushed off screen to the right at the same time
What actually happens:
first, the background view and navigation bar slide off screen, the picker remains in place
then, after they are gone, the picker slides off to the right also
When I use the custom control inside the view controller's main view, it animates away just like the standard keyboard. So it seems as though this is a function of "coming from" the navigation bar, which is animated separately from the views inside.
How can I fix this, so that the inputView slides out with the rest of the content?
Turns out this can be fixed by calling endEditing: on the UINavigationController's view. In other words, within a view controller:
[self.navigationController.view endEditing:YES];
This causes the input view to slide down while the rest of the view slides off to the right. Not exactly the same as the system keyboard, but not obviously weird.

UITabBarItem and its UIViewController - a complex issue

I have a bit of complex issue with a UITabBarItem it's UIViewController. Basically I have a series of UIButtons which is a layer on top of UITabBar, if the a UIButton is selected the right UITabBarItem is selected.
The complex issue starts when I have a UIViewController that is displayed when one of the UITabBarItem is pressed this takes the whole screen and displays a series of UIButtons. Once you press a button it returns back to the UITabBarItem selected but what I want in the UIViewcontroller is to have a dynamic UIView. I can get everything else working except that because the viewDidLoad is pre-loaded within that view.
Any suggestions. Sorry if that was a mouthful!
Now that I understand what you are asking, it seems that you need the view within the fifth tab to change based on what button is pressed - you can achieve this by making a bunch of graphic buttons to fill the view, then to have the fullscreen overlay you need to have your view present the new view as a modal view controller.
[self presentModalViewController:controllerForButton1 animated:NO]
This actually doesn't have much to with tab bars, this just happens to be within a tab bar controller, and they used the fifth view to hold a big menu, because there weren't enough tabs to suit their need.

hiding tabbar and navbar

I have a uiwebview in a navigation bar which is in turn inside a tabbar item. I want to know how to hide the tabbar and navigation bar the moment the user takes off his finger from the screen just like hiding the toolbar in the default photos app in the iPhone.
I should also be able to show the tabbar and the navigation bar when i touch my uiwebview again.
By default, a UIWebViewDelegate is not equipped to receive touch events... however, if you subclassed the UIWebView as UIControl (which can accept touch events), you could link the UIWebView's touchUpInside: method provided by UIControl to code that hides the navigation bar.
To hide the navigation bar, you could use:
[self.navigationController setNavigationBarHidden:YES animated:YES];
Then, you could use similar UIControl implementation do detect when a finger has left the UIWebView, etc.