2

I would like to have the keyboard already displaying when I show my view.

I have two view controllers, of which the keyboard is part of the second. However, when I call [textField becomeFirstResponder] during the second view controller's viewDidLoad method, the keyboard slides up on top of the first view.

Is there any way I can have the keyboard already slid up into place but still covered by the first view until I want to uncover it?

Thanks

Harry
  • 2,805
  • 1
  • 19
  • 12

3 Answers3

2

I just started iphone dev this week but saw this post. Don't know if this helps at all or not.

http://www.iphonedevsdk.com/forum/iphone-sdk-development/2716-uisearchbar-show-keyboard-load.html

TEEKAY
  • 1,156
  • 1
  • 10
  • 25
  • Thanks for the link. However, I can get the keyboard to show fine. The problem is that it slides up infront of a view that it should be hidden behind. I just can't figure out how to get the keyboard to slide up behind my top level view so that I can uncover it later on without having to display the sliding up animation – Harry Jun 19 '09 at 18:49
  • Hey Harry, did you ever figure this out? I'm having the same issue… – theory Mar 29 '10 at 19:00
0

The keyboard is added as a subview to the UIWindow instance on purpose so you can't do what you are asking.

You may be able to get around it. There are ways to find the keyboard:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/6573-howto-customize-uikeyboard.html

Once you have the keyboard, you might be able to reorder it to the back by rearranging the subviews of the UIWindow instance, but this is not guaranteed and definitely not supported. if you get this to work, it may break in the future.

Corey Floyd
  • 25,929
  • 31
  • 126
  • 154
  • That's a shame. I was kind of hoping it was just added as a subview of the textfield's parent view. I'll check out the reordering of UIWindow's subviews, but it's a tad hacky for my liking. Thanks for the useful answer – Harry Jun 20 '09 at 13:13
0

Despite this question being years old, i'll answer it and help people in future.

Add

[searchBar becomeFirstResponder];    

in your ViewDidLoad method.

"searchBar" is the outlet of my search bar.

mhorgan
  • 886
  • 2
  • 11
  • 32
  • In this case you at least in iOS 7 you will have from-bottom animation. UIKeyboard will not be a part of animating screen while pushing view controller into navigation controller. [The universal solution is here](http://stackoverflow.com/a/20639142/2066428) – malex Dec 17 '13 at 16:34