Проблема решена с помощью пользовательского жеста.
Файл: -MyGesture.h
#import <UIKit/UIKit.h>
@interface MyGesture : UIGestureRecognizer
@end
Файл: -MyGesture.m
#import "MyGesture.h"
@implementation MyGesture
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
if (self.state == UIGestureRecognizerStatePossible) {;
self.state = UIGestureRecognizerStateBegan;
}
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
self.state = UIGestureRecognizerStateEnded;
}
@end
Как использовать: -
MyGesture *gesture = [[MyGesture alloc] initWithTarget:self action:@selector(myGesture:)];
[self.scrollView addGestureRecognizer:gesture];
- (void)myGesture:(MyGesture *)sender {
if (sender.state == UIGestureRecognizerStateBegan) {
NSLog(@"tapStartGesture");
} else if (sender.state == UIGestureRecognizerStateEnded) {
NSLog(@"tapEndGesture");
}
}