How to pull up a UIKeyboard without a UITextField or UITextView?

Kriem picture Kriem · Sep 3, 2009 · Viewed 13.6k times · Source

I'm currently developing an OpenGL ES game for the iPhone and iPod touch.

I was wondering how I can easily pull up the UIKeyboard? Is there an official, documented possibility to pull up a UIKeyboard without using a UITextField of UITextView?

Answer

john picture john · Sep 26, 2011

If you subclass UIResponder, and declare the UIKeyInput protocol, the keyboard will appear when you become the firstResponder.

See the UIKeyInput protocol here.

One thing that tripped me up is that you'll need to override the canBecomeFirstResponder message.