以编程方式显示 iPhone 键盘
我想展示 iphone 键盘。如何编写代码(以编程方式)来显示键盘。
I want show the iphone keyboard. How can I write the code (programmatically) to show the keyboard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Jacob 所说,您必须在
UITextView
上运行becomeFirstResponder
才能使其成为第一响应者,即用户当前正在使用的对象。如果您这样做,iPhone 操作系统会自动显示键盘,因为从用户角度来看,这是使用UITextView
所需要的。As Jacob said, you'll have to run
becomeFirstResponder
on aUITextView
to make it the first responder, the object the user's currently working with. If you do this, the iPhone OS automatically shows the keyboard, cause that's what's needed for working with aUITextView
from a user perspective.正如其他人所指出的,您将
becomeFirstResponder
消息发送到您希望键盘编辑的控件。您应该注意的另一件事是,如果您将外部键盘插入 iPad,则键盘将不会出现在屏幕上。您需要设计您的视图,使其在没有屏幕键盘的情况下看起来不会很愚蠢。
As others have noted, you send the
becomeFirstResponder
message to the control that you want the keyboard to edit.One extra thing you should be aware of is that if you plug an external keyboard into an iPad then the keyboard will not appear on screen. You need to design your view so it doesn't look silly without the on-screen keyboard.