Re: bind imageView data to NSArrayController objectAtIndex:
Re: bind imageView data to NSArrayController objectAtIndex:
- Subject: Re: bind imageView data to NSArrayController objectAtIndex:
- From: mmalc crawford <email@hidden>
- Date: Tue, 14 Aug 2007 10:47:22 -0700
On Aug 14, 2007, at 10:31 AM, Cathy Shive wrote:
I have a number of imageView's (10 for arguments sake) in my Nib and
would like to bind their data values to my:
[[NSArrayControllers arrangedObjects] objectAtIndex:anIndex] for
each
of the 10 imageView's
Is this possible with IB, or must it be done programmatically?
Neither.
You cannot bind to the n'th element in an array.
How about using key value observing instead?
Bindings uses KVO.
You still have the same problem -- you cannot directly observe the
n'th element of an array...
You probably have some 'controller' class that's managing your views,
right? Add that class as an observer to the array controller's
@"arrangedObjects" key path. Then implement
observeValueForKeyPath:ofObject:change:context. In that method you
can update the content of your views to reflect changes in the array
controller's arranged objects.
... in a common case, it's likely to be the 'controller' object that's
managing the collection of image data and maintaining references to
the image views; it is in the best position to manage updating the
views itself, without the need for an array controller, bindings, or
KVO...
It would be useful to know what ad veloper is trying to achieve, what
objects contain the image data, and how they are managed.
mmalc
_______________________________________________
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