Re: Set a view's delegate using IB
Re: Set a view's delegate using IB
- Subject: Re: Set a view's delegate using IB
- From: Quincey Morris <email@hidden>
- Date: Tue, 06 Sep 2011 12:51:20 -0700
On Sep 6, 2011, at 12:20 , Luc Van Bogaert wrote:
> I've been struggling trying to set a viewcontroller (loaded by its own nib) as the delegate of another (main) viewcontroller's view in IB, while at the same time avoiding 'awakefromnib' being called twice on the former viewcontroller object, because of it being part of the latter viewcontroller's nib. I haven't succeeded so far, so I finally decided to use code. But, I'm still wondering if this is at all possible using IB. Any ideas?
It's not clear which of the 2 nib files contains the view controller. You first say it's "loaded by its own nib", then you say it's "part of the [main view controller's] nib". Which is it?
It's also not clear what the "this" is that you want to do using IB. Clearly, you can't use IB to prevent 'awakeFromNib' being called twice. Why do you care if 'awakeFromNib' is called twice, and if you care why don't you solve the problem it causes in 'awakeFromNib' itself (such as setting a flag to prevent your custom initialization being done twice), for which you're presumably writing code anyway?
Also, you can perhaps take the alternative path of overriding the view controller's 'loadView' instead of 'awakeFromNib'. That should be executed only once, although at a different point in the view life cycle.
_______________________________________________
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