Re: Notifications vs. messaging
Re: Notifications vs. messaging
- Subject: Re: Notifications vs. messaging
- From: Markus Hitter <email@hidden>
- Date: Mon, 1 Oct 2001 13:01:43 +0200
Am Montag, 1. Oktober 2001 um 00:41 schrieb Brian Hook:
Is there a simple guideline as to when to use a notification
vs. when to send a message directly?
sending a method directly:
- much less overhead
- only one object per call
- is executed immediately
- you can get a return value
sending a notification:
- some overhead for queueing
- can be received by several subscribers
- is queued and sent from within the run loop. This makes a
difference, for example if you want to open a sheet in
-awakeFromNib .
An intermediate between both is to "inject" a method into the run loop:
[[NSRunLoop currentRunLoop]
performSelector:@selector(methodToPerform)
target:self argument:nil order:0
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
or to use a NSTimer.
Have fun,
Markus
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/