small medium large xlarge

07 Sep 2010, 16:01
kai (1 post)

I am a bit confuse when we create the the Window Controller instance in the HelloApplicationDelegate.

In chapter 14:

(void)applicationDidFinishLaunching:(NSNotification *)aNotification 
  [[WindowController alloc] initWithWindowNibName:@"MainWindow"];
  • Do we need to create a member variables to capture the return value of the WindowController?
  • When it reaches the end of this function, wouldn’t the WindowController instance get destroyed?
  • If we do the same thing with ActivityController & CurrentApp (i.e not capturing the returned instance using a member variable), I notice that both instances will get destroyed right after the WindowController init() method returns. But it is not the case here with WindowController.


18 Aug 2011, 06:15
Tony Ketteringham (1 post)

In xcode 4.2 it appears you need to have something to actually make the window appear. I added the following in HelloApplicationAppDelegate.h:

@property (strong) MyWindowController *wc;

As well as the obligatory ` @synthesize ` and assignment as suggested. Cheers

You must be logged in to comment