Ios 对于';没有可见的@界面;主场景';声明选择器';AddGestureRecognitor:&x27;
我试图在我正在开发的游戏中使用手势,当我使用下面的代码时,它给出了上述错误Ios 对于';没有可见的@界面;主场景';声明选择器';AddGestureRecognitor:&x27;,ios,xcode,cocos2d-iphone,Ios,Xcode,Cocos2d Iphone,我试图在我正在开发的游戏中使用手势,当我使用下面的代码时,它给出了上述错误 UISwipeGestureRecognizer* up = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeUp)]; [up setDirection:(UISwipeGestureRecognizerDirectionUp)]; [self addGestureRecognizer:up]; 请提供帮助。您
UISwipeGestureRecognizer* up = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeUp)];
[up setDirection:(UISwipeGestureRecognizerDirectionUp)];
[self addGestureRecognizer:up];
请提供帮助。您只能在视图中添加手势识别器 代码中的最后一行应更改为:
[self.view addGestureRecognizer:up];
谢谢你,亚当。。我找到了答案。我应该使用下面的代码。[[[CCDirector sharedDirector]查看]添加标识识别器:向上];