Re: unexpected nil outlet
Re: unexpected nil outlet
- Subject: Re: unexpected nil outlet
- From: "David Wilson" <email@hidden>
- Date: Tue, 17 Jun 2008 20:56:23 -0400
- awakeFromNib
Is the function you should be looking at.
On Tue, Jun 17, 2008 at 8:47 PM, William Squires <email@hidden> wrote:
> I'm trying to code a solution to the challenge "Make a Delegate" in chapter
> 6 of the new Hillegaas book. Here is my AppController.h
>
> @interface AppController : NSObject
> {
> IBOutlet NSWindow *window;
> }
>
> @end
>
> and my AppController.m
>
> #import <Cocoa/Cocoa.h>
> #import "AppController.h"
>
> @implementation AppController
>
> - (id) init
> {
> NSLog(@"init");
> if ([super init])
> {
> // Register self as delegate
> NSLog(@"window = %@", window);
> [window setDelegate:self];
> }
> return self;
> }
>
> - (NSSize) windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
> {
> NSSize newSize;
>
> NSLog(@"windowWillResize:toSize:");
> newSize.height = frameSize.height;
> newSize.width = frameSize.height * 2;
> return newSize;
> }
>
> I then launched IB on MainMenu.xib, added an Object to MainMenu.xib window,
> changed its class to AppController, and connected its outlet to the window
> (right-click on object, then drag from the circle to the window.) I can
> confirm the connection is made in IB, but when I launch the app in Xcode
> (3.1), I get the message:
>
> 2008-16-07 19:40:44:335 WindowServer[2413:10b] window = (null)
>
> from my NSLog() in the init() method! What (simple, stupid, dumbhead) thing
> have I missed?
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
- David T. Wilson
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden