gpt4 book ai didi

keyboard - 我可以通过触摸 DialogViewController (MonoTouch.Dialog) 的背景来关闭 iPhone 键盘吗?

转载 作者:行者123 更新时间:2023-12-02 22:09:01 24 4
gpt4 key购买 nike

Possible Duplicate:
MonoTouch.Dialog: Dismissing keyboard by touching anywhere in DialogViewController

我正在使用 MonoTouch.Dialogs 中的 DialogViewController。我希望能够通过单击对话框的背景来关闭键盘。

我通常采用用大的自定义按钮填充 View 并将其放置在所有其他元素后面的技术。但是,我无法在 DialogViewController 中完成这项工作。我在 LoadView 中执行了此操作,它只是卡住了所有其他控件。

有没有一种相对简单的方法来实现我想要的?

最佳答案

在 View Controller 中:

public override void TouchesBegan (NSSet touches, UIEvent evt)
{
base.TouchesBegan (touches, evt);

myField.ResignFirstResponder();
}

编辑:根据我的阅读,您可以使用单元格 subview 的 TouchesBegan 事件而不是表本身。我不确定这是否有效。祝你好运:)

关于keyboard - 我可以通过触摸 DialogViewController (MonoTouch.Dialog) 的背景来关闭 iPhone 键盘吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3463778/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com