views:

67

answers:

2

I know there is an NSSomething() that is called automatically if it exists when the app starts and can be used to set for example the text of a label.

I just can remember the name of that function.

help?

Thanks!

+4  A: 

applicationDidFinishLaunching or application:didFinishLaunchingWithOptions: is probably what you're looking for.

Mark Rushakoff
no, it was awakeFromNib. thanks!
Uri
See Peter Hosey's comment on your answer. `-awakeFromNib` is not called on app launch, it's called when a nib is unarchived and its outlets are live. It is very important that you understand the distinction. If you want a method that is called on app launch, use one of the `NSApplication` delegate methods that Mark has given in his answer. You should mark his answer as correct because it is, and it directly answers your question.
Rob Keniger
+2  A: 

The answer is awakeFromNib, example:

- (void)awakeFromNib
{
   DoSomething();
}
Uri
That's not performed on app launch, it's performed on awake from nib, exactly as the method name says. Now, these may be coincidental, as the MainMenu nib is loaded on launch and so its objects are awakened on launch; nonetheless, they are two separate events and you would do well to not confuse them.
Peter Hosey
Thanks for the clarification. This, however, was what I was looking for
Uri