Re: unexpected nil outlet
Re: unexpected nil outlet
- Subject: Re: unexpected nil outlet
- From: William Squires <email@hidden>
- Date: Tue, 17 Jun 2008 19:56:24 -0500
Oh, and never mind. No one need respond to this - problem solved. I
put the delegate caca in the awakeFromNib() method instead...
On Jun 17, 2008, at 7:49 PM, William Squires wrote:
Oh, there's an "@end" at the end of the .m file, too, before anyone
jumps on this... :D
On Jun 17, 2008, at 7:47 PM, William Squires 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:
40satx.rr.com
This email sent to 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