当我使用此代码在 UIImageView 上滑动时,我正在尝试 NSLog,但由于某种原因它不起作用。任何想法 ?
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *image = [UIImage imageNamed:@"image2.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = [[UIScreen mainScreen] bounds];
[self.view addSubview:imageView];
UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightSwipeHandle:)];
[recognizer setNumberOfTouchesRequired:1];
[imageView addGestureRecognizer:recognizer];
}
- (void)rightSwipeHandle:(UISwipeGestureRecognizer*)gestureRecognizer {
NSLog(@"right swipe");
}