On Apr 3, 2012, at 15:29 , Michael Crawford wrote:

> Using and NSArrayController I'd like to bind the controller to an instance of 
> NSMutableArray, which under certain circumstances may contain zero objects.  
> I don't have any real experience with NULL placeholders but I assume this 
> situation is what they are for.  Can someone give me some guidance regarding 
> how to leverage NULL placeholders in this situation or better yet, point me 
> to an example?
> 
> Alternatively, I'm thinking I can create my own dummy (placeholder) object 
> and insert it into the array when there are no other real object instances to 
> be accessed.  If you have an opinion on this work-around, I'd like to hear 
> from you, as well.

There's nothing wrong with having an array of 0 elements, and no general need 
to create a placeholder to deal with this situation.

Presumably, the real issue is what to show in your user interface when the 
array is empty, but you didn't give us much to go on for that.

Note that array controllers automatically provide some placeholder objects for 
various situations, including no selection, multiple selection, and a nil 
object. Depending on what you're trying to do, these might provide a solution 
without additional coding.

Can you back up one step and describe the problem you're actually trying to 
solve?


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to