如何通过按NSButton显示键盘? [英] How to show a keyboard via press a NSButton?
问题描述
我只知道在iOS上显示键盘的几种方法
I only know few ways to show a keyboard on iOS
触摸文本字段,搜索栏,textview .....
touch textfield,search bar,textview.....
是否可以通过触摸按钮来显示键盘???
Is it can via touch a button to show keyboard ???
我希望我可以用这种方式设置一个按钮,如果按钮是没有或者可以重命名。
I wish I can use this way to set a button tittle if the button is no tittle or can rename it.
谢谢你们〜
推荐答案
您需要在视图中添加 UITextField
,然后调用 [myTextfield becomeFirstResponder];
可能将隐藏的attrribute从 UITextField
设置为 YES
- 这样用户将永远不会看到文本字段。键盘输入完成后,您可以使用 removeFromSuperview
删除 UITextField
。
You need to add an UITextField
to your view and call then [myTextfield becomeFirstResponder];
Its possible to set the hidden attrribute from UITextField
to YES
- so the user will never see the textfield. After Keyboard input is finished you can remove the UITextField
with removeFromSuperview
.
也许有点脏,但这就是我经常使用的解决方案。我想知道SDK是否提供了另一种可能性。
Maybe a little bit dirty, but thats the solution I used often. I wonder if the SDK provide another possibility.
这篇关于如何通过按NSButton显示键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!