FROM : Jonathon Mah
DATE : Wed Apr 06 17:02:11 2005
On 6 Apr 2005, at 23:51, Christian Schneider wrote:
> But what I really want to know is, how can my controller (the class
> with -clip and -setClip:) be notified that its object has changed? Do
> I have to bind to its various changeable instance variables via KVO?
When you are modifying your object, you need to tell KVO that it
changed. If you change it by using setClip: then KVO will handle it for
you. Otherwise you need to wrap the code that changes clip with:
[self willChangeValueForKey:@"clip"];
cilp = someNewStuffHere;
[self didChangeValueForKey:@"clip"];
Ideally though, you want to change it only through accessor methods,
which will handle the notification stuff automatically.
Jonathon Mah
<email_removed>
DATE : Wed Apr 06 17:02:11 2005
On 6 Apr 2005, at 23:51, Christian Schneider wrote:
> But what I really want to know is, how can my controller (the class
> with -clip and -setClip:) be notified that its object has changed? Do
> I have to bind to its various changeable instance variables via KVO?
When you are modifying your object, you need to tell KVO that it
changed. If you change it by using setClip: then KVO will handle it for
you. Otherwise you need to wrap the code that changes clip with:
[self willChangeValueForKey:@"clip"];
cilp = someNewStuffHere;
[self didChangeValueForKey:@"clip"];
Ideally though, you want to change it only through accessor methods,
which will handle the notification stuff automatically.
Jonathon Mah
<email_removed>
| Related mails | Author | Date |
|---|---|---|
| Christian Schneide… | Apr 6, 16:21 | |
| Jonathon Mah | Apr 6, 17:02 | |
| Christian Schneide… | Apr 7, 09:30 |






Cocoa mail archive

