NSApplication and -applicationDidFinishLaunching:

I have an application where I have main.m that returns NSApplicationMain(argc, (const char **) argv); .

I want to run the code on -applicationDidFinishLaunching: but I just don't see how to do it.

Can anyone help or have an example?

Thanks! Jason

+4
source share
2 answers

The applicationDidFinishLaunching: method of the NSApplication delegate method will be called when the application finishes loading. Many project templates are set by the delegate. If you use, just add the appropriate method to it.

If your project does not have an installed application delegate, you will need to do it yourself. First, create a new class to work as your delegate (you can use it if there is something logically appropriate). Now make sure the class is created in your MainMenu.nib. Finally, set the delegate property of the File object to the instance instance in IB.

+15
source

Louis's answer is short and spot-on. However, if the concept of delegate methods is not new to you, you should familiarize yourself with the relevant documentation .

0
source

All Articles