Re: Is cascading Nib Loading from -awakeFromNib permissible?
Re: Is cascading Nib Loading from -awakeFromNib permissible?
- Subject: Re: Is cascading Nib Loading from -awakeFromNib permissible?
- From: Ken Thomases <email@hidden>
- Date: Wed, 11 Mar 2009 18:03:58 -0500
On Mar 11, 2009, at 5:49 PM, Stuart Malin wrote:
I am getting infinite calls, not double calls.
It sounds to me like you're getting double calls and you're turning
them into infinite calls. If you load a nib inside of -awakeFromNib,
and you don't guard against being called again, you'll load the nib
again, get -awakeFromNib again, load the nib again, ... infinitely.
Further, the second Nib I am loading has no references back to the
controller, except as File's Owner.
And that's enough to get awakeFromNib'd.
From the documentation for the awakeFromNib method:
"It is recommended that you maintain a one-to-one correspondence
between your File’s Owner objects and their associated nib files.
Loading two nib files with the same File’s Owner object causes that
object’s awakeFromNib method being called twice, which could cause
some data structures to be reinitialized in undesired ways. It is also
recommended that you avoid loading other nib files from your
awakeFromNib method implementation."
So, you're going against Apple's recommendation in two ways.
Regards,
Ken
_______________________________________________
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