【发布时间】:2009-10-13 17:17:11
【问题描述】:
我已经解决了以下问题。
Objective C - Where do you dealloc global static variables?
但问题与静态变量有关。它和我的情况不同。
我在应用程序中有以下代码。
//.h file
#import "cocos2d.h"
#import "something.h"
#import "myLayer.h"
#import "LayerData.h"
// i have taken this variables as global
// because two different classes are simultaneously accessing it
myLayer *myCurrentLayer;
LayerData *boxLayerData[10][12];
@interface one
// my class definition here
@end
@interface two
// my second class definition here
@end
//------------------------------------------------
@implementation one
// my class constructor here.
-(id)init{
myCurrentLayer=[[myLayer alloc] init];
// boxLayerData is initialized with objects
}
@end
@implementation two
// second class constructor
-(id)init{
[myCurrentLayer setPosition:ccp(10,20)];
[self schedule something for movements];
}
@end
//------------------------------------------------
好的。我的困惑是“如何解除 120 大小的”LayerData *boxLayerData[10][12];”数组?”
【问题讨论】:
标签: objective-c xcode global-variables cocos2d-iphone