Re: NSArray or MutableArray Null/NIL placeholder
Re: NSArray or MutableArray Null/NIL placeholder
- Subject: Re: NSArray or MutableArray Null/NIL placeholder
- From: Charles Steinman <email@hidden>
- Date: Wed, 30 May 2007 07:57:22 -0700 (PDT)
To insert a null object into an array, use NSNull. And no, it's not necessary to retain an object before you put it into an array. NSArray copies its contents.
Cheers,
Chuck
Vince Ackerman <email@hidden> wrote: I need to have an array of 16 (id) objects. When I create them, I
want to keep them in a specific order at a specific index in the
array. If I dispose of the object, I want the index in the array to
be empty, not back filled by the next object as suggested by the
docs. I want to be able to test the index to see if any object is
currently at that index. My question is this: Somewhere I read that
you can't insert a nil object into NSArray? What would I use as a
placeholder that would indicate an empty slot in the array? Would
null work?
Searching the docs for NSMutableArray doesn't seem to give me an
answer. All the methods seem to avoid leaving an empty index.
Also, do I need to retain/release an object when inserting/deleting
the object in an Array, or does NSArray do this automatically?
Maybe I'm misunderstanding nil/null.
Thanks in advance for any help.
Vince
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
---------------------------------
Got a little couch potato?
Check out fun summer activities for kids.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden