如何在按钮单击时弹出默认的iPhone键盘

aqa*_*cha 5 iphone objective-c ios-4.2

嗨当我们点击UITextField或UITextView时,默认键盘会从iphone屏幕的底部弹出.我希望iphone键盘出现在按钮上,然后按键盘上键入的键处理...我该怎么做?

May*_*ari 5

在按钮上添加touchupinside事件并为textview或textfield调用becomeFirstResponder方法,它将调用弹出键盘.看下面的代码 -

-(IBAction)buttonClicktoModalView:(id)sender{
[textView becomeFirstResponder];
}
Run Code Online (Sandbox Code Playgroud)


aqa*_*cha 3

我正在搜索我的问题,并发现了以下 stackoverflow 链接,它回答了我的问题

如何在没有 UITextField 或 UITextView 的情况下拉起 UIKeyboard?

谢谢