I often add the following to the app delegate's applicationDidFinishLaunching: method

[self performSelector: @selector(applicationDidBeginRunLoop:) withObject: self afterDelay: 0.0];

applicationDidBeginRunLoop: (which you must define) will execute when the first runloop cycle executes.

NOTE that you should (IMHO) endeavor to defer as much initialization as possible until after the runloop has started, to avoid the annoying bouncing-forever-in-the-dock behavior, or worse, the dreaded lollipop- of-death.

This means that you should keep your MainMenu.nib as small as possible, and avoid doing much in the app delegate's initialization delegate methods beyond setting a flag to validate that they have occurred.

Even the invocations of applicationOpenFile(s): can be deferred by simply queuing the information in an array and processing it later when the run loop is operational.

Nearly any application can be designed as a "one-bounce" (or less) app, but it is best to implement that at the beginning of the design process, not try to graft it on at the end.

Even if you have some sort of lengthy initialization process (updating a database from a remote server, say) that must be done before the app is "useful", you should still defer this until the runloop (and thus the UI) is operational. The user can at least fiddle with the preferences or adjust window size and position, (or watch a progress panel) and you have the full capabilities of Cocoa available during your initialization.





On May 9, 2009, at 5:58 PM, Mitchell Livingston wrote:

In what method would that need to be in to get the key on startup? I tried without luck in init and awakeFromNib.

On Saturday, May 09, 2009, at 06:48PM, "Kirk Kerekes" <kirkkere...@gmail.com > wrote:
        
How About: ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)





_______________________________________________

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