• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: @property and @synthesize not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @property and @synthesize not working


  • Subject: Re: @property and @synthesize not working
  • From: "Michael Ash" <email@hidden>
  • Date: Thu, 14 Aug 2008 00:20:25 -0400

On Wed, Aug 13, 2008 at 10:27 PM, Nathan Gilmore <email@hidden> 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 (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

References: 
 >@property and @synthesize not working (From: Nathan Gilmore <email@hidden>)
 >Re: @property and @synthesize not working (From: Andrew Merenbach <email@hidden>)
 >Re: @property and @synthesize not working (From: Nathan Gilmore <email@hidden>)

  • Prev by Date: Re: compile error when protocol not implemented?
  • Next by Date: Re: What's the use of the Z_UUID in the Z_METADATA table?
  • Previous by thread: Re: @property and @synthesize not working
  • Next by thread: Re: @property and @synthesize not working
  • Index(es):
    • Date
    • Thread