在SKScene游戏中,我分配了场景,但是它在No visible @interface with 'SKScene' declares the selector alloc.中有一个错误消息
我认为这意味着我没有在我的界面上声明它?请更正。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInNode:self];
SKNode *node = [self nodeAtPoint:location];
// if play button touched, start transition to next scene
if ([node.name isEqualToString:@"play"]) {
NSLog(@"play pressed");
SKScene *GameScene = [[GameScene alloc] initWithSize:self.size];
SKTransition *flip = [SKTransition flipVerticalWithDuration:1.0];
[self.view presentScene:GameScene transition:flip];
}
}发布于 2014-03-18 03:11:25
看起来,您正在尝试创建一个与类同名的变量!
SKScene *GameScene = [[GameScene alloc] initWithSize:self.size];这可能会使编译器感到困惑。将*GameScene的变量名更改为其他变量,并查看它是否有效。
https://stackoverflow.com/questions/22468161
复制相似问题