Try doing something along these lines, I have not seen your code so this is probably not an exact solution to your problem, but hopefully it will help you understand the message passing required to solve your problem.
//FirstClass .h file
#import @"SecondClass.h"
@interface FirstClass : NSObject {
NSArray *firstArray;
SecondClass *sec;
}
@property(nonatomic, retain) NSArray *firstArray;
@property(nonatomic, retain) SecondClass *sec;
@end
//Add this to FistClass .m file
@synthesize firstArray, sec;
-(id)init{
if(self == [super init]){
sec = [[SecondClass alloc] init];
firstArray = [[NSArray alloc] initWithArray:sec.secondArray];
}
return self;
}
-(void)dealloc{
[firstArray release];
[super dealloc];
}
//SecondClass .h file
@interface SecondClass : NSObject {
NSMutableArray *secondArray;
}
@property(nonatomic, retain) NSMutableArray *secondArray;
@end
//Add this to SecondClass .m file
@synthesize secondArray;
-(id)init{
if(self == [super init]){
secondArray = [[NSMutableArray alloc] initWithObjects:@"Obj1", @"Obj2", @"Obj3", nil];//etc...
//Maybe add some more objects (this could be in another method?)
[secondArray addObject:@"AnotherObj"];
}
return self;
}
-(void)dealloc{
[secondArray release];
[super dealloc];
}