unexpected nil outlet
unexpected nil outlet
- Subject: unexpected nil outlet
- From: William Squires <email@hidden>
- Date: Tue, 17 Jun 2008 19:47:42 -0500
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