开发者

Creating splash screen Cocoa

I have been looking for a way to display a splash screen on a cocoa app im making(not ipho开发者_StackOverflow中文版ne) and am very new im not asking if you think its a good idea or not because i know how it could be annoying for users. Its helping me learn.

I was wondering if there was a way to create a splash screen on a timer?

could anyone breifly walk me through it or point me in the right direction?


Easiest way I can think of is to add the splash screen's window to MainMenu.xib, and mark it as visible at launch - that way you don't need to worry about loading and showing it, all that will happen by default. In your app delegate's -applicationDidFinishLaunching:, start an NSTimer instance. When it fires, send your splash window a -close message.

(Edit) Okay, I know you didn't ask if it's a good idea or not, but here's my two cents anyway - if your app needs to load & initialize a bunch of plugins or perform some other lengthy operation before it's ready to be used, then a splash screen with an updating status would be less annoying than having to sit there just wondering what's going on...

(Edit.2) More about the plugin loading. You could write a method that loads one plugin, then uses NSTimer to call itself with zero delay if there are more plugins to load. Doing it via zero-delay timers, instead of a simple for() or while() loop, would allow the run loop to stay active, so you could update a progress bar and avoid the spinning technicolor pizza of death.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜