UIScrollView перехватывает все сенсорные события, потому что он должен решить, если / когда пользователь двигал пальцем, чтобы прокрутить представление прокрутки.Возможно, вы захотите создать подкласс UIView, затем в методах
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)evt;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)evt;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)evt;
проверьте наличие необходимых касаний, затем перенаправьте все эти методы в ваш UIScrollViewInstance.Например:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface MyView: UIView {
UIScrollView *scrollView;
}
@end
@implementation MyView
/* don't forget to alloc init your ScrollView init -init
and release it in -dealloc! Then add it as a subview of self. */
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)evt
{
/* check for a gesture */
[scrollView touchesBegan:touches withEvent:evt];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)evt;
{
/* check for a gesture */
[scrollView touchesMoved:touches withEvent:evt];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)evt;
{
/* check for a gesture */
[scrollView touchesEnded:touches withEvent:evt];
}
@end