【问题标题】: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];