Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

11. Notifikationen absetzen und abfangen > 11.10 Lösung: Eigene Notifikationen ...

11.10 Lösung: Eigene Notifikationen empfangen

Sie kennen die einzelnen Schritte dieser Übung. Fassen wir also zusammen: die Methoden registerNotications und setUpNotication:withSelector: aus CurrentApp einfügen und registerNotications aus awake-FromNib heraus aufrufen.

Wenn Sie eine Notifikation empfangen, müssen Sie den Stringwert von activeDisplay auf „Launched“ oder „Terminated“ setzen.

Notication/HelloApplication6/ActivityController.m

#import "ActivityController.h"
#import "CurrentApp.h"

@implementation ActivityController

@synthesize currentApp, activityDisplay;

-(void) applicationDidLaunch: (NSNotification *) notification {
    [self.activityDisplay setStringValue:@"Launched."];
}
-(void) applicationDidTerminate: (NSNotification *) notification {
    [

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial