PDA

View Full Version : How to show a Splash UI before App run?




xiaohuli170
Mar 26, 2009, 04:32 AM
Now I want to show a splash Ui before App run , but I didn't know how to do with cocoa, somebody can give me some code about it , Thanks very much! The splash ui I think it is a pucture , but how to show it before app running?



kainjow
Mar 26, 2009, 08:40 AM
Make a borderless window (google NSBorderlessWindowMask) and add an NSImageView to it, then show at startup.

GorillaPaws
Mar 26, 2009, 08:46 AM
then show at startup.

Would you do this through a custom awakeFromNib? or is there a better strategy?

kainjow
Mar 26, 2009, 08:50 AM
Would you do this through a custom awakeFromNib? or is there a better strategy?

Usually it's at awakeFromNib or applicationDidFinishLaunching. awakeFromNib should probably be reserved for setting up UI stuff specific to that nib, while applicationDidFinishLaunching is better for general launch tasks. But it's still up to how the app was written.

xiaohuli170
Mar 26, 2009, 09:22 PM
First Thank you very much. And I show the window in applicationWillFinishLaunching method use orderFront,then hide it in applicationDidFinishLaunching: use orderOut,Now I found that the mainWindow not to show and the app terminate ,why ? How to do to resolute this question? Thanks!

kainjow
Mar 28, 2009, 10:48 AM
If your app is quitting without you quitting it yourself, then it's probably crashing.