Harry
Harry

Reputation: 2805

Load iPhone keyboard before displaying view

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

Upvotes: 2

Views: 4151

Answers (3)

mhorgan
mhorgan

Reputation: 886

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.

Upvotes: 0

Corey Floyd
Corey Floyd

Reputation: 25969

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.

Upvotes: 0

TEEKAY
TEEKAY

Reputation: 1186

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

Upvotes: 2

Related Questions