嗨,我正在尝试使用手势识别器与我的精灵套件游戏,我写了这段代码
@interface GameScene() <UIGestureRecognizerDelegate>{
UISwipeGestureRecognizer *swipeGestureLeft;
ISwipeGestureRecognizer *swipeGestureRight;
}
@end
@implementation GameScene
-(id)initWithSize:(CGSize)size{
if(self = [ super initWithSize:size]){
}
return self;
}
-(void)didMoveToView:(SKView *)view{
swipeGestureLeft = [[UIGestureRecognizer alloc]initWithTarget:self action:@selector(swipeLeft)];
[swipeGestureLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
[view addGestureRecognizer:swipeGestureLeft];
swipeGestureRight = [[UIGestureRecognizer alloc]initWithTarget:self action:@selector(swipeRight)];
[swipeGestureRight setDirection:UISwipeGestureRecognizerDirectionRight];
[view addGestureRecognizer:swipeGestureRight];
}
- ( void ) willMoveFromView: (SKView *) view {
[view removeGestureRecognizer: swipeGestureLeft ];
[view removeGestureRecognizer: swipeGestureRight];
}
-(void)swipeLeft:(UISwipeGestureRecognizer*) recognizer{
NSLog@"Left"'
}
-(void)swipeRight:(UISwipeGestureRecognizer*) recognizer{
NSLog@"Right"'
}
@end
Run Code Online (Sandbox Code Playgroud)
我认为每件事都没问题,但我的手势不起作用,我没有错误信息,是否有什么遗漏我应该添加到我的应用程序,或者我应该添加一些东西给我的视图控制器,或者你们可以建议我一个totorial向我展示了如何使用sprite kit手势,
我正在使用 ionic CLI 版本 4.12.0 创建应用程序,当我使用此命令ionic Cordova platform add ios
ionic CLI 添加我的应用程序的 Xcode 文件时,但是当我在真实设备上运行该应用程序时,我收到此错误
ERROR: Start Page at 'www/index.html' was not found。和
Internal navigation rejected - <allow-navigation> not set for url='about:blank'
Run Code Online (Sandbox Code Playgroud)
我认为我的 ionic CLI 不会像 ionic3 CLI 那样生成 www 文件夹文件,是否缺少某些内容。www 文件夹完全是空的,并且未显示在 Xcode 文件中