• 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: NSArray or MutableArray Null/NIL placeholder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray or MutableArray Null/NIL placeholder


  • Subject: Re: NSArray or MutableArray Null/NIL placeholder
  • From: Vince Ackerman <email@hidden>
  • Date: Wed, 30 May 2007 08:07:11 -0700

Chuck,

Thanks. I just discovered this link which pretty much tells me how to do it:

file:///Developer/ADC Reference Library/documentation/Cocoa/ Conceptual/NumbersandValues/index.html

Vince



On May 30, 2007, at 07:57, Charles Steinman wrote:

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:
40yahoo.com


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


References: 
 >Re: NSArray or MutableArray Null/NIL placeholder (From: Charles Steinman <email@hidden>)

  • Prev by Date: Re: NSArray or MutableArray Null/NIL placeholder
  • Next by Date: Re: NSArray or MutableArray Null/NIL placeholder
  • Previous by thread: Re: NSArray or MutableArray Null/NIL placeholder
  • Next by thread: Re: NSArray or MutableArray Null/NIL placeholder
  • Index(es):
    • Date
    • Thread