iphone - 检测 entryelement 的键盘何时返回 monotouch.dialog

标签 iphone ios xamarin.ios monotouch.dialog

我正在使用此代码来检测从 monotouch.dialog 中的输入元素的键盘返回。

   RltEntryElement createServerUrlEntry(){

        try {


            ServerNameEntryElement = new EntryElement ("Website url","placeholder",
        "value");


            ServerNameEntryElement .ReturnKeyType = UIReturnKeyType .Done ;
             ServerNameEntryElement.ShouldReturn += ShouldReturnMethd;
            return ServerNameEntryElement ;

        } catch (Exception ex) {
            RltLog .HandleException (ex);
            return null ;
        }
    }

public bool ShouldReturnMethd ()
        {

            RltLog .LogInfo ("Helllllllllllllo");
            return false  ;
        }

在按下“完成”后,它可以正常工作并记录 "Helllllllllllllo"。但键盘不会消失。我应该如何使用它才能正常工作?

最佳答案

只需调用“ResignFirstResponder”

public bool ShouldReturnMethd ()
{
    RltLog.LogInfo ("Helllllllllllllo");
    ServerNameEntryElement.ResignFirstResponder(true);
    return false;
}

关于iphone - 检测 entryelement 的键盘何时返回 monotouch.dialog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16538842/

相关文章:

ios - Xamarin Forms 上的 UIWebView 弃用和 App Store 拒绝

iphone - 动态改变 UITableView 的内容

ios - 在 webView iOS Swift 中使用 http 时出现黑屏

ios - 如何使用Xamarin打开iPhone LED?

ios - 转换与更改 UIView 的框架?

iphone - 使用其他用户名登录 FaceBook

ios - 如何更改 GetCell() 中的单元格颜色?

iphone - UIKIt:调整 View 大小以适应 subview

iOS:本地化独立于 iPad 语言设置的应用程序

iphone - 如何关闭 UIWebView 上的键盘?