Array passing between classes, gone?
Hey guys . i have two classes, SelectionScreenTable & GraphView.
In the SelectionScreenTable class .h, i declared a NSMutableArray called usagedatas
NSMutableArray *usagedatas;
}
@property (nonatomic, retain) NSMutableArray *usagedatas;
In the SelectionScreenTable class.m i remembered to @synthesize. Later on, while processing my methods, i did a
NSLog(@"usagedatas count:%i",usagedatas.count);
to check whether it has value and it returned 1. so yeah its good up to this point.
And in the -(void) dealloc , i remembered to released it .
[usagedatas release];
So now comes ME trying to use it in another class.
In GraphView.m i imported the "SelectionScreenTable.h". in the -(void)viewDidLoad i did
SelectionScreenTable *UD = [SelectionScreenTable alloc];
NSLog(@开发者_如何学Go"GraphView UD.usagedataas.count = :%i",UD.usagedatas.count);
it returned 0.
Any idea guys?
Hey guys, i solved it by creating the array in the AppDelegate instead. then in SelectionScreenTable i get the array from the AppDelegate and edit it. Then in GraphView i just call the array from the AppDelegate and it returns a value.
精彩评论