FROM : Steven Kramer
DATE : Thu Oct 07 15:02:32 2004
Op 6-okt-04 om 12:57 heeft Patrick Machielse het volgende geschreven:
>> Because the array controller performs manual notification would be my
>> guess.
>
> That does _sound_ logical: if the controller doesn't automatically
> notify
> observers, but observers still get notified, the controller _must be_
> notifying observers manually.
>
> However, that begs the question: what would be the difference between
> manual
> and automatical notification? Either the obeject notifies observers,
> or it
> doesn't, in which case there isn't much use in registring or binding.
>
> Maybe I'm missing something, but wouldn't the method be better named
> 'notifiesObserversForKey:'?
>
> I don't see the difference between notifying and 'automatically'
> notifying?
> I fear I don't fully grasp the concept here :-(
>
Using manual notification, your 'set' method will do (something similar
to)
- (void) setMyKey: (int) newMyKey
{
[self willChangeValueForKey: @"myKey"];
myKey = newMyKey;
[self didChangeValueForKey: @"myKey"];
}
Using automatic notification, your 'set' method will be transparently
overridden at run-time to send didChange/willChange. That is, the
bindings run-time support will send those messages before/after your
setMyKey is called. Your setter does not need to know anything about
KVO.
Regards
Steven
DATE : Thu Oct 07 15:02:32 2004
Op 6-okt-04 om 12:57 heeft Patrick Machielse het volgende geschreven:
>> Because the array controller performs manual notification would be my
>> guess.
>
> That does _sound_ logical: if the controller doesn't automatically
> notify
> observers, but observers still get notified, the controller _must be_
> notifying observers manually.
>
> However, that begs the question: what would be the difference between
> manual
> and automatical notification? Either the obeject notifies observers,
> or it
> doesn't, in which case there isn't much use in registring or binding.
>
> Maybe I'm missing something, but wouldn't the method be better named
> 'notifiesObserversForKey:'?
>
> I don't see the difference between notifying and 'automatically'
> notifying?
> I fear I don't fully grasp the concept here :-(
>
Using manual notification, your 'set' method will do (something similar
to)
- (void) setMyKey: (int) newMyKey
{
[self willChangeValueForKey: @"myKey"];
myKey = newMyKey;
[self didChangeValueForKey: @"myKey"];
}
Using automatic notification, your 'set' method will be transparently
overridden at run-time to send didChange/willChange. That is, the
bindings run-time support will send those messages before/after your
setMyKey is called. Your setter does not need to know anything about
KVO.
Regards
Steven
| Related mails | Author | Date |
|---|---|---|
| Patrick Machielse | Sep 30, 22:32 | |
| Jacob Lukas | Oct 1, 00:55 | |
| Scott Stevenson | Oct 1, 01:14 | |
| Scott Stevenson | Oct 1, 01:20 | |
| Jacob Lukas | Oct 1, 01:26 | |
| Scott Stevenson | Oct 1, 02:46 | |
| Jacob Lukas | Oct 1, 03:09 | |
| Scott Stevenson | Oct 1, 05:05 | |
| Jacob Lukas | Oct 1, 08:18 | |
| Christian Brunsche… | Oct 1, 11:03 | |
| Patrick Machielse | Oct 1, 11:24 | |
| Patrick Machielse | Oct 1, 13:26 | |
| Patrick Machielse | Oct 1, 13:35 | |
| Eric Ocean | Oct 1, 17:37 | |
| Scott Stevenson | Oct 1, 23:38 | |
| Scott Stevenson | Oct 1, 23:40 | |
| Patrick Machielse | Oct 4, 13:56 | |
| Steven Kramer | Oct 4, 17:09 | |
| Patrick Machielse | Oct 6, 12:57 | |
| Steven Kramer | Oct 7, 15:02 |






Cocoa mail archive

