创建闪屏 Cocoa

发布于 2024-10-25 08:31:54 字数 158 浏览 6 评论 0原文

我一直在寻找一种在我正在制作的可可应用程序(不是iPhone)上显示启动屏幕的方法,我很新,我不会问你是否认为这是一个好主意,因为我知道这可能会让用户感到烦恼。它帮助我学习。

我想知道是否有办法在计时器上创建启动画面?

有人可以简短地引导我完成它或为我指出正确的方向吗?

I have been looking for a way to display a splash screen on a cocoa app im making(not iphone) 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぇ气 2024-11-01 08:31:54

我能想到的最简单的方法是将启动屏幕的窗口添加到 MainMenu.xib 中,并将其标记为在启动时可见 - 这样您就无需担心加载和显示它,所有这些都会默认发生。在应用程序委托的 -applicationDidFinishLaunching: 中,启动 NSTimer 实例。当它触发时,向您的启动窗口发送一条 -close 消息。

(编辑)好吧,我知道你没有问这是否是一个好主意,但无论如何,这是我的两分钱 - 如果你的应用程序需要加载和加载。在准备使用之前初始化一堆插件或执行一些其他冗长的操作,然后带有更新状态的启动屏幕将比坐在那里只是想知道发生了什么更烦人......

(编辑2)更多关于插件加载。您可以编写一种方法来加载一个插件,然后在有更多插件需要加载时使用 NSTimer 以零延迟调用自身。通过零延迟计时器而不是简单的 for() 或 while() 循环来执行此操作将允许运行循环保持活动状态,因此您可以更新进度条并避免旋转的彩色死亡披萨。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文