我可以通过触摸 DialogViewController (MonoTouch.Dialog) 的背景来关闭 iPhone 键盘吗?
可能的重复:
MonoTouch.Dialog:通过触摸 DialogViewController 中的任意位置来关闭键盘
我正在使用 MonoTouch.Dialogs 中的 DialogViewController。我希望能够通过单击对话框的背景来关闭键盘。
我通常采用用大的自定义按钮填充视图并将其放置在所有其他元素后面的技术。但是,我无法在 DialogViewController 中完成这项工作。我在 LoadView 中执行了此操作,它只是冻结了所有其他控件。
有没有一种相对简单的方法来实现我想要的?
Possible Duplicate:
MonoTouch.Dialog: Dismissing keyboard by touching anywhere in DialogViewController
I'm using DialogViewController from MonoTouch.Dialogs. I'd like to be able to dismiss the keyboard by clicking on the background of the dialog.
I usually employ the technique of filling the view with a large custom button and placing it behind all the other elements. However, I can't make this work in the DialogViewController. I did this in LoadView and it just froze all the other controls.
Is there a relatively straightforward way of achieving what I want?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在视图控制器中:
编辑:根据我的阅读,您可以使用单元格子视图的 TouchesBegan 事件而不是表本身。我不确定这是否有效。祝你好运 :)
In view controller:
Edit: From what I've read, you can use the TouchesBegan event for the cell subview instead of the table itself. I'm not positive that works. Good luck :)
miguel.de.icaza 在另一个线程上回答了这个问题:
https://stackoverflow.com/a/10864640/1134836。
他的解决方案:
miguel.de.icaza answered this question on a different thread:
https://stackoverflow.com/a/10864640/1134836.
His solution: