简体   繁体   English

如何制作自定义键盘?

[英]How to make a custom keyboard?

What are the rules I need to follow, when creating a custom keyboard for a UITextView? 为UITextView创建自定义键盘时,我需要遵循哪些规则?

  1. Is it OK to use a subclass of UIView? 可以使用UIView的子类吗?
  2. Do I need to implement a specific protocol? 我需要实施特定的协议吗?
  3. Should it contain a variable with a specific type and name? 它是否应该包含具有特定类型和名称的变量?
  4. Anything else? 还要别的吗?

At this point I have already made my own keyboard with the buttons; 至此,我已经用按钮制作了自己的键盘。 and it shows up when the UITextView object becomes the FirstResponder as expected. 并在UITextView对象成为预期的FirstResponder时显示。 But I cannot use it and I would like to know if there is a "proper way" or if I just have to find my own way to make things work. 但是我无法使用它,我想知道是否存在“正确的方法”,或者我是否只需要找到自己的使工作正常的方法。

Thanks in advance. 提前致谢。

Set inputView property of UITextView with your custom keyboard & refer to this link: 使用自定义键盘设置UITextView的inputView属性,并参考以下链接:

UITextView inputView UITextView inputView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM