当您转换到新视图并触摸该视图中的任何内容时,我的spriteKit游戏会崩溃。我在原始视图中使用了scrollView,并发现它是问题(当它不存在时它可以工作)任何帮助都会很棒:)
我在这里添加了scrollView
CGAffineTransform verticalFlip = CGAffineTransformMakeScale(1,-1);
scrollViewMenu = [[UIScrollView alloc]initWithFrame:self.frame];
scrollViewMenu.backgroundColor = [UIColor redColor];
scrollViewMenu.contentSize = CGSizeMake(self.frame.size.width, scrollBackGround1.frame.size.height+scrollBackGround2.frame.size.height);
scrollViewMenu.transform = verticalFlip;
scrollViewMenu.hidden = true;
[self.view addSubview:scrollViewMenu];
[self.view addGestureRecognizer:scrollViewMenu.panGestureRecognizer];
scrollViewMenu.delegate = self;
[self.view sendSubviewToBack:scrollViewMenu];
我用这个
过渡到另一个场景JMLevel01 *level = [[JMLevel01 alloc]initWithSize:CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height)];
[self.view presentScene:level];
这是我的willMoveFromView
[super willMoveFromView:view];
[self.view removeGestureRecognizer:scrollViewMenu.panGestureRecognizer];
scrollViewMenu = nil;
谢谢!