如何在 iPhone 上按“完成”时禁用输入板?
我想在按“完成”时禁用 iPhone 上的输入板。 关于如何检测按钮按下事件有什么想法吗?
I want to disable input pad on iphone when pressing 'done'. Any ideas about how to detect button press event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编程方法
要注册按钮按下事件,您可以采用编程方法:
其中buttonPressed:是“self”类中的方法:
当然,您可以指定指向任何对象而不是“self”的指针,只要该对象有一个buttonPressed:方法。
Interface Builder
您还可以使用Interface Builder。 创建一个要执行的方法:
然后右键单击界面生成器中的按钮。 您应该看到操作列表。 在“touch up”操作中,单击圆形按钮,然后将连接器拖动到表示放置 buttonPressed: 方法的类的对象。
禁用输入板
我不确定你的意思。 您是在谈论消除键盘输入吗? 如果是这样,您必须调用“resignFirstResponder:”方法。 例如,由于您正在编辑文本字段,因此键盘会弹出。 要关闭键盘,请在文本字段上调用以下方法:
Programatic Method
To register button press events you can either do the programmatic approach:
Where buttonPressed: is a method in the class "self":
You can specify a pointer to any object instead of "self" of course, as long as the object has a buttonPressed: method.
Interface Builder
You can also use Interface Builder. Create a method that you want to execute:
Then right click on the button in interface builder. You should see a list of actions. On the "touch up" action click on the circle button, and drag a connector to the object representing the class where you put the buttonPressed: method.
Disabling Input Pad
I'm not sure what you mean by this. Are you talking about dismissing a keyboard input? If so, you have to call the "resignFirstResponder:" method. Say, for example, the keyboard pops up because you are editing a text field. To dismiss the keyboard call the following method on the text field: