试图继承CCMenuItemImage

时间:2012-09-06 09:09:38

标签: ios cocos2d-iphone

我用这个init方法继承CCMenuItemImage

-(id)initWithChildren:(id)targetedApplication {
    if(self = [super initFromNormalImage:@"Answer_Box.png" selectedImage:@"Answer_Box.png" disabledImage:@"Answer_Box.png" target:targetedApplication selector:@selector(answerButtonTapped:)] ) {
            NSLog(@"Yes?");
            return self;
    }
    return self;

}
-(void)answerButtonTapped:(id)stuff {
    NSLog(@"Answer Button Tapped");
}

并且每次在控制台中出现此错误都会崩溃

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil'

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

是-answerButtonTapped一个靶向应用程序的方法?它应该是那一个。错误说目标中没有这样的功能。或者你可以传递“self”而不是“targetApplication”