• 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: Outlets Not Connected In awakeFromNib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Outlets Not Connected In awakeFromNib


  • Subject: Re: Outlets Not Connected In awakeFromNib
  • From: Carlos Eduardo Mello <email@hidden>
  • Date: Sat, 05 Mar 2011 20:47:05 -0300


On Mar 5, 2011, at 4:00 PM, Matt Neuburg wrote:

I'm not grasping where there can be any source of confusion here. awakeFromNib is very simple: it is sent to an object after that object is instantiated from a nib. That's straightforward and dependable and clear - provided you know what a nib is, of course. The only "subtle difference" between Mac OS X and iOS in this regard is that in iOS you are enjoined to call super in your implementation. (There are some memory management differences for objects instantiation from nibs between Mac OS X and iOS, but that's a different matter.)

What you say about viewDidLoad is perfectly true, but should not be an issue provided you do in viewDidLoad only things that are suitable for viewDidLoad (i.e. things that can do no harm if done more than once)

I am pretty knew to cocoa and everything, and agree that awakeFromNib seems pretty straight forward, but I accidentally came across one of those double calls and found out something interesting: in a document template-based app, I connected a custom view to an outlet in my document class in order to setup it up and use it. Then I coincidentaly named a method in my document class as a setter to that outlet. Apparently that triggered the window controler (or some other part of the document architecture) to call awakeFromNib while my outlet was still nil (note that several other outlets in the same window were already instantiated...). I tested it many times and as soon as I changed the name of that method everything behaved as expected. Apparently the controller noticed the key-value path was available and offered a chance of bypassing the nib. Does that make any sense or am I totally wrong here? (Couldn't find an explanation in the documentation...)


_______________________________________________

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: 
 >Re: Outlets Not Connected In awakeFromNib (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: XML Namespace Definitions on Non-Root Elements
  • Next by Date: rerunning an NSOperation object
  • Previous by thread: Re: Outlets Not Connected In awakeFromNib
  • Next by thread: Re: Outlets Not Connected In awakeFromNib
  • Index(es):
    • Date
    • Thread