[英]iOS No visible @interface for 'ViewController' declares the selector addGestureRecognizer error
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 'ViewController'没有可见的@interface声明选择器addGestureRecognizer错误
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. addGestureRecognizer是UIView上的方法,而不是UIViewController上的方法。
Try 尝试
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(isTapped:)]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.