> On Jan 18, 2015, at 00:26 , Quincey Morris > <[email protected]> wrote: > > On Jan 18, 2015, at 00:10 , Rick Mann <[email protected]> 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.
I don't want to make it a feature of the object, because the selection is a property of the view(controller). That is, I have multiple views into my model, and selecting an object in one view doesn't necessarily mean it's selected elsewhere (I'm 99% sure that's what I want). Because in many places bindings take care of showing selection, the NSArrayController is the best thing to manage the selection. -- Rick Mann [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
