这个错误是什么意思?以下是我的代码。但我没有看到任何错误
-(id) init
{
if( (self=[super init] )) {
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCSprite *player = [CCSprite spriteWithFile:@"Player.png"
rect:CGRectMake(0, 0, 27, 40)];
player.position = ccp(player.contentSize.width/2, winSize.height/2);
[self addChild:player];
}
if( (self=[super initWithColor:ccc4(255,255,255,255)] ))
{
}
return self;
}
答案 0 :(得分:1)
如果在@interface ... @end块之外编写属性或方法声明,则会出现此错误,特别是如果将其放在@interface之前或@end之后。以下是导致此错误的示例:
@interface MyClass : NSObject
{
// instance vars here
}
// properties and method declarations here
@end
// ERROR: method declared outside @interface (after @end)
-(void) someMethodWithObject:(id)obj;