Re: Controller and NIB
Re: Controller and NIB
- Subject: Re: Controller and NIB
- From: Graham Cox <email@hidden>
- Date: Wed, 29 Oct 2008 09:23:56 +1100
On 29 Oct 2008, at 9:09 am, J. Todd Slack wrote:
What is a full proof way to have code executed when a NIB is loaded?
When my MainMenu.nib displays its Window, I want to execute some code.
If you have an object in the nib, its -awakeFromNib method will be
called. The object can be an instance of any class, say 'MyObject'.
However you do have to put that object in the nib - just having it in
your code won't do anything because there's nothing instantiating it.
You can drag a generic object into your nib in IB and then use the
properties inspector to set its class to whatever you want, e.g.
'MyObject'.
Another way if you only need some code to run when the app is launched
is to implement an application delegate and override the -
applicationDidFinishLaunching: method.
hth,
Graham
_______________________________________________
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