スクロールビューを特定の領域でのみスクロール可能にしようとしています。これを行うために、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が通常は消費しないタッチ(タップなど)に対してのみ呼び出されます。すべてのタッチをインターセプトする方法はありますか?
どこかでコンセプトが欠けていると思います。