• 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: A simple doubt about array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A simple doubt about array


  • Subject: Re: A simple doubt about array
  • From: Matt Gough <email@hidden>
  • Date: Wed, 11 Jun 2008 10:56:22 +0200


On 11 Jun 2008, at 03:09, Jens Alfke wrote:

That way you won't run into the issue that NSArray objects can't contain empty (nil) elements...

Another thing that is often overlooked by Cocoa newbies is that you can add NSNull to NSArray objects (and other collection objects)


e.g

MyObj* anObj = somethingPossiblyNil;

[myArray addObject: anObj ? anObj : [NSNull null]];

...

MyObj* obj = [myArray objectAtIndex:1];
if (obj != [NSNull null])
{
	// It really is a MyObj
}

Matt
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: A simple doubt about array (From: Adam Leonard <email@hidden>)
 >Re: A simple doubt about array (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: creating and using a View xib
  • Next by Date: Re: Garbage collector vs variable lifetime
  • Previous by thread: Re: A simple doubt about array
  • Next by thread: Issue with displaying URI prefixes on child elements using NSXML
  • Index(es):
    • Date
    • Thread