问题描述
我正在使用MonoTouch.Dialogs中的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.
我通常采用的技术是用一个大的自定义按钮填充视图,并将其放置在所有其他元素的后面.但是,我无法在DialogViewController中使其工作.我是在LoadView中完成此操作的,它只是冻结了所有其他控件.
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?
推荐答案
在视图控制器中:
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
base.TouchesBegan (touches, evt);
myField.ResignFirstResponder();
}
据我了解,您可以将TouchesBegan事件用于单元格子视图,而不是表本身.我不认为这行得通.祝你好运:)
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 :)
这篇关于我可以通过触摸DialogViewController(MonoTouch.Dialog)的背景来关闭iPhone键盘吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!