11.5 Am Controller festhalten

Wir haben unsere Instanz von CurrentApp als Observer für Notifikationen eingerichtet. Das einzige Objekt, das eine feste Referenz zu diesem Objekt besitzt, ist unsere Instanz des ActivityController. Der ActivityController wurde in der .nib-Datei angelegt, aber bisher interessiert sich niemand für ihn.[79]

Lassen Sie uns im App-Delegate ein Outlet hinzufügen:

Notication/HelloApplication3/HelloApplicationAppDelegate.h

   #import <Cocoa/Cocoa.h>
▸ @class ActivityController;

   @interface HelloApplicationAppDelegate : NSObject <NSApplicationDelegate> {
       NSWindow *window;
▸     ActivityController *ac;
   }
   @property IBOutlet NSWindow *window;
▸ @property IBOutlet ActivityController *ac;
   @end

Wechseln Sie in die Implementierungsdatei und ...

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.