How do I set an Array in one class with another array in another class in Objective-C

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 3:13 UTC
Read the original article Hit count: 533

Filed under:
|
|
|

Hi Guys,

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... I don't know why this is...

Please help point me in the right direction...

Thanx guys

Stef :-)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsarray