开发者

Objective-C inheritance problem

I'm doing the following:

#import <Foundation/Foundation.h>
#import "CCMenuItem.h"


@interface SmartMenuItem : CCMenuItemSprite {

}

@end

Then I want to use my class:

SmartMenuItem *playItem = [SmartMenuItem itemFromNormalSprite:play
                                                     selectedSprite:playPressed
                                                             target:self 
                                                           selector:@selector(onPlayPressed)];
SmartMenuItem *optionsItem = [SmartMenuItem itemFromNormalSprite:options
                                                        selectedSprite:optionsPressed
                                                                target:self
                                                              selector:@selector(onOptionsPressed)];

[menu_ addChild:playItem];
[menu_ addChild:optionsItem];

And i got errors and warnings. Menu accepts CCMenuItemSprite as child. Bu开发者_JAVA技巧t xcode says: Cannot initialize a parameter of type CCNode* with an lvalue of type SmartMenuItem*.

And also it gives warnings when i'm creating playItem and optionsItem: method not found. But it is a static method of CCmenuItemSprite!

What's the problem ?


Solved. The problem was in adding files to xcode project. They were shared incorrectly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜