• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMutableArray morphs itself into an NSArray?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: NSMutableArray morphs itself into an NSArray? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: OK, but what do 'attributes' look like?
  • Next by Date: Re: OK, but what do 'attributes' look like?
  • Previous by thread: Re: NSMutableArray morphs itself into an NSArray?
  • Next by thread: Re: NSMutableArray morphs itself into an NSArray?
  • Index(es):
    • Date
    • Thread