我可以通过触摸 DialogViewController (MonoTouch.Dialog) 的背景来关闭 iPhone 键盘吗? [英] Can I dismiss the iPhone keyboard by touching the background of DialogViewController (MonoTouch.Dialog)?

查看:21
本文介绍了我可以通过触摸 DialogViewController (MonoTouch.Dialog) 的背景来关闭 iPhone 键盘吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
MonoTouch.Dialog:通过触摸DialogViewController中的任意位置来关闭键盘

我正在使用 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 键盘吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆