How do I set an array in one class with another array in another class

Posted by Stef on Stack Overflow See other posts from Stack Overflow or by Stef
Published on 2010-04-04T03:09:31Z Indexed on 2010/04/04 7:43 UTC
Read the original article Hit count: 380

Filed under:
|
|
|

I've populated and array with data like this in one class...

PowerClass.h 

NSMutableArray pickerArray;
@property (nonatomic, retain) NSMutableArray pickerArray;

-

PowerClass.m

@synthesize pickerArray;

@implementation
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"stef", @"steve", @"baddamans", @"jonny", nil];
pickerArray = [NSMutableArray arrayWithArray:array];

And I'm trying to set the Array in another class

WeekClass.h

PowerClass          *powerClass;
NSMutableArray  *pickerData;

@property (nonatomic, retain) NSMutableArray pickerData;
@property (nonatomic, retain) PowerClass *powerClass;

WeekClass.m

@implementation
pickerData = [NSMutableArray arrayWithArray:powerClass.pickerArray];

I have no errors or warnings. It just crashes. The NSLog says that the powerClass.pickerArray is NULL.

Please help point me in the right direction.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsarray