![](/img/trans.png)
[英]No Visible @interface for 'MainScene' declares the selector 'addGestureRecognizer:'
[英]iOS No visible @interface for 'ViewController' declares the selector addGestureRecognizer error
我正在嘗試將手勢識別器添加到主視圖,但出現此錯誤:
'ViewController'沒有可見的@interface聲明選擇器addGestureRecognizer錯誤
在這條線上:
[self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(isTapped:)]];
你們誰都知道錯誤的原因或如何解決此錯誤?
addGestureRecognizer是UIView上的方法,而不是UIViewController上的方法。
嘗試
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(isTapped:)]];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.