Re: Problems with 2 classes HELP
Re: Problems with 2 classes HELP
- Subject: Re: Problems with 2 classes HELP
- From: Robert Cerny <email@hidden>
- Date: Fri, 13 Feb 2004 15:29:04 +0100
Hi,
try this one:
NSArray *demo = [NSArray arrayWithArray:[collection retrieveArray];
NSArray is not mutable object so you can't change it.
HTH
Robert
On 13.2.2004, at 14:44, Roberto Sobachi wrote:
I've got a problem with 2 classes.
I'm trying to pass the value from a class to another, but the
controller class, doesn't mantain objects.
This is the example.
Controller class: I call a function of another class to load an NSArray
with property datas.
CollectionList *collection = [[CollectionLists alloc] init];
[collection loadXML];
NSArray *demo = [[NSArray alloc] init];
demo = [collection retrieveArray]; It returns a 0 count NSArray
The other class has:
- (CollectionList *) init
{
[super init];
collection = [[NSMutableArray alloc] init];
return self;
}
- (void)loadXML
{
NSString *path = [@"~/Library/Demo/Demo.xml"
stringByExpandingTildeInPath];
collection = [[NSMutableArray arrayWithContentsOfFile: path] retain];
NSLog(@"%i", [collection count]); it Returns count Array > 0
}
- (NSMutableArray *) retrieveArray
{
return(collection);
}
Thanks
Roberto
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.