我想使一个滚动视图只能在某个区域上滚动。为此,我将UIScrollView继承并覆盖touchesBegan(类似于this question)。UIScrollView子类永远不会收到touchesBegan消息的刷卡
这是我的(很简单)代码。
.H
@interface SuppressableScrollView : UIScrollView
@end
的.m
#import "SuppressableScrollView.h"
@implementation SuppressableScrollView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"touchesBegan touches=%@ event=%@", touches, event);
[super touchesBegan:touches withEvent:event];
}
@end
的touchesBegan只被称为该UIScrollView的不正常消耗(抽头等)的触摸。任何想法如何拦截所有的触摸?
我想我错过了某个地方的概念。