Re: NSMutableArray morphs itself into an NSArray?
Re: NSMutableArray morphs itself into an NSArray?
- Subject: Re: NSMutableArray morphs itself into an NSArray?
- From: Mark Munz <email@hidden>
- Date: Mon, 8 Mar 2004 23:41:56 -0700
On Mar 8, 2004, at 8:16 PM, Jerry Krinock wrote:
After reading the great discussion on alloc/init vs.
convenience/retain, I
went back to my code and I think maybe I found the problem, getting
back to
my original question of: Can an NSMutableArray morph itself into an
NSArray?
The first time I use this NSArray, I do this:
crontabLines = (NSMutableArray*)[aString componentsSeparatedByString:
@"\n"];
I think you want to do something like this:
[crontabLines removeAllobjects];
[crontabLines addObjectsFromArray:[aString
componentsSeparatedByString:@"\n"]];
That will add the objects returned by componentsSeparatedByString into
your mutable array.
So rather than setting the crontabLines variable to a new object (an
NSArray),
you're using the object to added the contents of that NSArray into your
MutableArray.
Mark Munz
_______________________________________________
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.