1

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

4

2 回答 2

1

只需调用“ResignFirstResponder”

public bool ShouldReturnMethd ()
{
    RltLog.LogInfo ("Helllllllllllllo");
    ServerNameEntryElement.ResignFirstResponder(true);
    return false;
}
于 2013-07-15T09:49:58.283 回答
0

难道不应该

return true;

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

于 2013-05-14T12:08:53.940 回答