I'm trying to add the gesture recognizer to the main view but I'm getting this error:
No visible @interface for 'ViewController' declares the selector addGestureRecognizer error
on this line:
[self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(isTapped:)]];
any of you knows why of the error or how can I fix this error?
addGestureRecognizer is a method on UIView, not UIViewController.
Try
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(isTapped:)]];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.