【问题标题】:Keyboard dismissed as soon as presented键盘一出现就关闭
【发布时间】:2014-02-04 22:21:30
【问题描述】:

我有一个涉及使用不同类型手势的应用程序。因此,为了区分这些手势,我使用了shouldRecognizeSimultaneouslyWithGestureRecognizer 方法,该方法返回“是”。但是,在执行此操作时,UIWebView 上的键盘在呈现后立即被关闭。如果我不这样做,那么键盘可以正常工作,但控制器无法识别不同的手势。 如何让键盘正常工作,同时识别不同的手势?

【问题讨论】:

    标签: ios objective-c cocoa-touch uiwebview uigesturerecognizer


    【解决方案1】:

    试试这个

    #pragma mark -
    #pragma mark UITextFieldDelegate Methods
    
    - (BOOL)textFieldShouldReturn:(UITextField *)textField {
        [textField resignFirstResponder];
        return YES;
    }
    
    - (void)textFieldDidEndEditing:(UITextField *)textField {
        [textField resignFirstResponder];
    }
    
    //You can use like this in your   shouldRecognizeSimultaneouslyWithGestureRecognizer  method
    [textView resignFirstResponder];
    

    【讨论】:

    • 问题是在 webView 的情况下关闭键盘。
    猜你喜欢
    • 2013-04-05
    • 2020-11-10
    • 2021-03-06
    • 1970-01-01
    • 2013-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多