how to popup default iphone keyboard on a button click

aqavi_paracha picture aqavi_paracha · Mar 7, 2011 · Viewed 9k times · Source

Hi When we click on a UITextField or UITextView, a default keyboard pops up from the bottom of iphone screen. I want iphone keyboard to appear on a button click, and then handle the keys as typed on keyboard... How can i do that?

Answer

Mayur Birari picture Mayur Birari · Mar 7, 2011

Add touchupinside event on button and call becomeFirstResponder method for textview or textfield it will call pop up keyboard. see the following code-

-(IBAction)buttonClicktoModalView:(id)sender{
[textView becomeFirstResponder];
}