12.9 Lösung: Aufräumen
Wir können auf die awakeFromNib
-Methode in ActivityController.m
verzichten, weil wir das Objekt im Nib erzeugen und dort auch seinen Delegate setzen.
Protocols/HelloApplication10/ActivityController.m
#import "ActivityController.h" #import "CurrentApp.h" @implementation ActivityController @synthesize activityDisplay; -(void) applicationDidLaunch: (CurrentApp *) app { [self.activityDisplay setStringValue:@"Launched"]; } -(void) applicationDidTerminate: (CurrentApp *) app { [self.activityDisplay setStringValue:@"Terminated"]; } @end
Wir benötigen keine currentApp
-Eigenschaft mehr. Entfernen Sie die Variablen- und Eigenschaftsdeklaration zusammen mit der Vorwärtsdeklaration aus der Header-Datei:
Protocols/HelloApplication10/ActivityController.h ...
Get Cocoa-Programmierung now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.