On Wed, Aug 13, 2008 at 10:27 PM, Nathan Gilmore <[EMAIL PROTECTED]> wrote:
> Hi Andrew,
>
> Thanks so much for your quick response and all of the great tips!
>
> You were right.  dayOneTasks was nil.
>
> I am a little confused about how this works with Interface Builder.  In
> MainMenu.nib, I have a DayOneTasks Controller.  It's class is set to
> DayTaskController.
>
> I also have the outlet for AppController.dayOneTasks set to the DayOneTasks
> Controller Object in the nib file. So, I guess by doing that,
> AppController.dayOneTasks still does not get initialized unless I call the
> alloc and init methods?

The problem is just that your code is running too early.

IBOutlets are connected after your class is alloc/inited. If you think
about it, this is how it must be: they cannot be connected *before*
that, because nothing exists to connect them *to*.

Happily, Apple (or rather, NeXT) anticipated this problem and provided
a solution: you can put "initialization" code that depends on
IBOutlets being properly connected in an -awakeFromNib method and that
code will be called after outlets are connected but before control is
returned to the nib loader.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to