Re: Testing selection with NSArrayController?
Re: Testing selection with NSArrayController?
- Subject: Re: Testing selection with NSArrayController?
- From: Quincey Morris <email@hidden>
- Date: Sun, 18 Jan 2015 08:26:42 +0000
On Jan 18, 2015, at 00:10 , Rick Mann <email@hidden> wrote:
>
> I'm building a view that renders a bunch of objects (a drawing canvas). Some of these render differently if the objects are selected. As I iterate through the list of objects to render, I need to test if each one is selected.
It would be easier to test if each one is in the array controller’s “selectedObjects”.
However, I wouldn’t do that either. Given that the selection status of an object affects its appearance, I’d say it’s better to make it an explicit property of each selectable object. Otherwise, you’re forced to drag the array controller’s API into all of your drawing code.
As far as I’m concerned, an array controller is a piece of glue code, a necessary evil. Any reference to it in code is at best a disappointment, at worst a design failure.
_______________________________________________
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