Re: Pointers and NSImages
Re: Pointers and NSImages
- Subject: Re: Pointers and NSImages
- From: Fritz Anderson <email@hidden>
- Date: Thu, 2 Nov 2006 10:04:08 -0600
On 2 Nov 2006, at 9:37 AM, Lorenzo wrote:
I create my picture
myPict = [[NSImage alloc] init...
Then many other objects use this picture.
[rectangle usePicture:myPict];
[circle usePicture:myPict];
When the user changes the picture I have to update the picture in
all the
objects. Instead I would like to use pointers and avoid to relink
all the
objects to the new picture all the time.
What you're saying is that you don't really want to track a particular
picture object, but rather the myPict property of whatever object
"owns" the picture. Solutions:
1. Define a notification type for a change-picture event, have the
owning object post an NSNotification whenever its picture changes, and
make the dependent objects observe the owner for that notification.
2. (10.3 and above) make the dependent objects key-value observers of
the owning object, and make sure the owning object uses KVC accessors
for the picture.
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden