在ScrollView Touch上重新启动First Responder [英] Resign First Responder on ScrollView Touch
本文介绍了在ScrollView Touch上重新启动First Responder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在ScrollView触摸事件中隐藏键盘...
How can I hide the keyboard on ScrollView touch event...
场景就像那样......
Scenario is like that...
- >查看 - > ScrollView - > Textfield
->View ->ScrollView ->Textfield
我想在触摸时隐藏键盘的scrollView。我试图覆盖滚动视图的类但仍然无法做到。
I want to hide the keyboard on touch of scrollView. I tried to override the class for scrollview but still i can't do it.
推荐答案
这样做会有所帮助:
@interface MyClass <UIScrollViewDelegate> {
}
@implementation
- (void)viewDidLoad {
yourScrollView.delegate = self;
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[myTextField resignFirstResponder];
}
如果你真的想要处理触摸事件,那么你需要子类化UIScrollView并覆盖方法:
If you really want to handle the touch event, then you need to subclass the UIScrollView and override the method:
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view {
}
更多关于 UIScrollView触摸
这篇关于在ScrollView Touch上重新启动First Responder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文