如何在 ScrollView 触摸事件上隐藏键盘...
场景是这样的...
->视图->滚动视图->文本字段
我想在触摸滚动视图时隐藏键盘。我尝试覆盖滚动视图的类,但仍然无法做到。
这样做会有所帮助:
@interface MyClass <UIScrollViewDelegate> {
}
@implementation
- (void)viewDidLoad {
yourScrollView.delegate = self;
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[myTextField resignFirstResponder];
}
如果你确实想处理触摸事件,那么你需要子类化 UIScrollView 并重写该方法:
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view {
}
更多关于UIScrollView触摸 http://developer.apple.com/iphone/library/documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html#//apple_ref/doc/uid/TP40006922-CH3-SW12
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)