On Nov 16, 2010, at 13:34, Dave Carrigan wrote:

> On Nov 16, 2010, at 1:29 PM, Laurent Daudelin wrote:
>> Hello.
>> 
>> I'm stomped by a strange problem. I've been working with a UIViewController 
>> subclass and it's been working fine, putting it on screen using 
>> "pushViewController:animated:".
>> 
>> Now, I would like to load the view controller and have it perform a method 
>> before I put it on screen. However, when I do that, the nib is not loaded 
>> even though I'm still using "initWithNibName:bundle:". The view's ivars are 
>> not set and it never receives "awakeFromNib".
>> 
>> What's this? Is there any way I can force it to load the nib? In the method 
>> I want to execute, there are a few references to nib objects but they are 
>> all set to nil after the alloc-initWithNibName:bundle:. I double-checked and 
>> the custom view controller receives the initWithNibName:bundle:. Everything 
>> works fine as long as I use pushViewController:animated:.
> 
> Why don't you just override -viewDidLoad.

I was already overriding it but since the view was not initiated from the nib, 
viewDidLoad: would not be called.

After browsing tons of initWithNibName:bundle: links, I finally found a 
workaround. In the calling view controller, after the call to 
initWithNibName:bundle:, I call something like [customViewController view]. 
This seems to force the lazy loading to happen.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin                                 
http://www.nemesys-soft.com/
Logiciels Nemesys Software                                              
laur...@nemesys-soft.com

_______________________________________________

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 arch...@mail-archive.com

Reply via email to