Re: IBOutlet objects not responding to any messages passed
Re: IBOutlet objects not responding to any messages passed
- Subject: Re: IBOutlet objects not responding to any messages passed
- From: Cormac Daly <email@hidden>
- Date: Thu, 22 Jan 2009 18:11:39 +0000
Thank you to everyone who replied to this query: it is now resolved.
I had created a custom class for the window controller in Interface Builder,
but I got rid of it and hooked up all the outlets via File's Owner instead.
I'm not sure exactly how this worked but it did!
Thanks again,
Cormac
On Thu, Jan 22, 2009 at 6:04 PM, Shawn Erickson <email@hidden> wrote:
> On Thu, Jan 22, 2009 at 2:44 AM, Cormac Daly <email@hidden> wrote:
>
> > Any ideas? Is there a problem in the ordering somewhere? Its probably
> > something very basic but I'm stumped!
>
> You are subclassing NSWindowController and NSWindowController will
> call windowDidLoad after the nib it loads is fully instantiated and
> wired up (outlets, etc. are set). In windowDidLoad (and after) it is
> safe to message outlets but before this point in time it is not. So
> what you tried in your init method isn't expected to work unless you
> send [self window]; after doing [super initWithWindowNibName:..].
>
> - (void) init
> {
> if ((self = [super initWithWindowNibName: @"LicensingWindow"]) != nil)
> {
> [self window]; force load of our window, windowWillLoad /
> windowDidLoad will fire
> // no safe to message outlets but likely best to UI object
> configuration in windowDidLoad instead of here
> }
> }
>
> If you aren't getting the what you expect in windowDidLoad then
> somehow your outlets are not hooked up correctly (at least not fully,
> sounds like your action connections are correct). I would compare the
> pointers you see in your outlets in windowDidLoad with the pointers
> you get via the "sender" parameter to your action methods to see if
> they are referencing the same objects (or NSLog(@"%@",
> theObjectPointer);) .
>
> As a guess... I bet you have an instance of your
> LicensingWindowController class instantiated in the nib that you are
> loading. You then connected the outlets from this in nib instance to
> your UI objects instead of connecting from File's Owner to your UI
> elements. You should not have an instance of LicensingWindowController
> inside of you nib since LicensingWindowController is meant to load and
> take ownership of a nib (aka become the File's Owner). Just make sure
> to change the class of File's Owner to be that of
> LicensingWindowController so you can see all of the actions and
> outlets you expect on File's Owner.
>
> Other possibilities are you simple didn't connect your outlets or
> possibly (long shot given the names you picked) you have setter
> methods masking your ivars that aren't setting instance vars
> correctly?
>
> -Shawn
>
--
Cormac
_______________________________________________
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