> On 5 Jun 2015, at 9:59 am, Frank D. Engel, Jr. <fde...@fjrhome.net> wrote:
> 
> 
> If I don't bind from there, I'm not sure where else to do it from?


In IB, in -awakeFromNib, in -windowDidLoad: (in a window controller), etc?

Anywhere but in the drawing pathway. I’m not sure whether bindings only makes 
single connection per binding even if called multiple times, or whether it adds 
a new one each time, but in the drawing pathway, it’s going to be called many 
times. If it makes a new binding each time, you could end up with hundreds of 
redundant KVO notifications when the property changes, with the app gradually 
getting slower and slower.

> In the future, I will be expanding the use of the "icon" to show it in places 
> besides the browser - I am considering the "icon" to be a calculated part of 
> the data model, with the "image" being part of one view which I expect to 
> later be many views against the same object, so trying to update from within 
> the source object isn't going to work unless I reinvent the wheel and 
> basically recreate the bindings or some other notification mechanism.

It’s perfectly reasonable that the ‘icon’ property is part of your data model, 
and that any number of views are bound to it. I’m not suggesting you update 
from within the source at all. I’m suggesting that you provide a method in the 
relevant controller that will update your browser cell and the right part of 
the view and bind that to the icon property. It doesn’t change the way the icon 
property works or how it gets its new data.

> The update of the icon is based on any of several properties of the source 
> object changing dynamically, sometimes by the user, and sometimes from a 
> method triggered an NSTimer (I am conditionally animating some of these 
> properties), and since the set of views against the object is likely to 
> change periodically while the application is running (and quite possibly in 
> the middle of those animations), with some views potentially changing which 
> objects they represent, I was hoping to avoid having to stoop to that level 
> (and didn't expect that I would need to) - but I will if that is what it 
> takes.

Not sure why this is a problem. All I’m suggesting is that a suitable method of 
the browser’s controller is bound to the icon. It doesn’t stop you binding 
other things to the same icon.

> I still need a pointer of some kind with the NSPopupButtonCell question.
> 

Can’t help you with that one - cells are gnarly, pop-up button cells doubly so.

—Graham




_______________________________________________

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