Cocoa touch 我们如何在classB中运行classA的CCAction?我们可以用什么方法?
我有行动*行动1;在甲级。我需要在B类中使用这个动作。 我需要运行action1和classB中的其他操作。我该怎么做? 我按照下面的方法做了,但没有工作Cocoa touch 我们如何在classB中运行classA的CCAction?我们可以用什么方法?,cocoa-touch,cocos2d-iphone,Cocoa Touch,Cocos2d Iphone,我有行动*行动1;在甲级。我需要在B类中使用这个动作。 我需要运行action1和classB中的其他操作。我该怎么做? 我按照下面的方法做了,但没有工作 warning: 'CCAction' may not respond to '+actionWithAction:' 这是我的A班和B班 @interface classA : CCLayer { CCAction *ActionScale; } @property (nonatomic, retain)CCAction *Act
warning: 'CCAction' may not respond to '+actionWithAction:'
这是我的A班和B班
@interface classA : CCLayer {
CCAction *ActionScale;
}
@property (nonatomic, retain)CCAction *ActionScale;
@end
#import "classA.h"
@implementation classA
@synthesize ActionScale;
-(id)init
{
if( (self = [super init]) )
{
...
ActionScale = [CCScaleBy actionWithDuration:1.0f scale:2.0];
}
return self;
}
//B类
@class classA;
@interface classB : CCLayer {
CCSprite *sprite1;
classA *object1;
}
@property(nonatomic, retain)classA *object1;
@end
#import "classB.h"
#import "classA.h"
@implementation classB
@synthesize object1;
-(id)init
{
if( (self = [super init]) )
{
...
...
id eggAction3 = [CCAction actionWithAction:object1.ActionScale];
}return self;
}
我们应该使用什么方法将一个类的CCAction调用到另一个类
谢谢。我不确定你到底想做什么,但你不能在B班说:
id eggAction3 = object1.ActionScale;
这将为您提供对另一个对象中的操作的引用,因为您已将其设置为另一个类中的属性
这可能有助于描述您试图通过此设置实现的目标