【问题标题】:Detecting when keyboard of a entryelement returns monotouch.dialog检测entryelement的键盘何时返回monotouch.dialog
【发布时间】:2013-05-14 08:52:37
【问题描述】:

我正在使用此代码来检测从 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"。但键盘并没有消失。我应该用它来正确地工作吗?

【问题讨论】:

    标签: iphone ios xamarin.ios monotouch.dialog


    【解决方案1】:

    只需调用“ResignFirstResponder”

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

    【讨论】:

      【解决方案2】:

      不应该吗

      return true;
      

      我最近没有看文档,但是方法的名称表明你可能想返回true

      【讨论】:

      • 感谢您的回复。当它返回 true 时,键盘也不会消失。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-16
      • 2012-01-09
      • 2012-03-29
      • 1970-01-01
      相关资源
      最近更新 更多