用于预加载应用程序的 UIProgressView

发布于 2024-12-29 09:24:38 字数 66 浏览 1 评论 0原文

有谁知道制作在应用程序加载时动画的加载栏的教程吗?除了用我不想要的按钮为其设置动画之外,我在任何地方都找不到任何东西。

Does anyone know of any tutorials for making a loading bar that animates as the app is loading? I can't find anything anywhere besides animating it with a button which I don't want.

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

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

发布评论

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

评论(2

夏末 2025-01-05 09:24:38

iPhone 应用程序加载的工作方式如下。

启动时,它会显示您在构建设置中指定的“启动图像”png 图像。 (一个很酷的技巧是将该屏幕截图作为您的第一个屏幕。它使您的应用程序看起来像是立即启动的)。

然后控制权传递给您的 Main.m 函数,该函数将构建您的窗口。

您要做的就是设置启动图像。然后构建一个新视图,并调用 main.m 函数。

查看 Erica Sadun 的 Iphone Cookbook 了解更多详细信息。 (或者只是浏览源代码,她几乎所有应用程序都是通过 Main.m 构建的)。

iPhone app loading works like this.

On launch it puts up the 'Launch Image' png image, that you specify in your build settings. (A cool trick is to make that a screen shot your first screen. It makes your app look like it launch instantly).

Then control passes to your Main.m function, which builds your windows.

What you will want to do, is set your launch image. Then build a new view which you call off your main.m function.

Check out Erica Sadun's Iphone Cookbook for more details. (Or just browse though the source code, she builds almost all of her apps off the Main.m).

时光清浅 2025-01-05 09:24:38

关于使用 UIProgressView 的文档是很清楚。

在您的情况下,从应用程序委托加载您的第一个视图控制器,以便在加载应用程序的其余部分时显示 UIProgressBar 是可见的。

然后开始加载应用程序数据的其余部分(无论是什么)。

UIProgressView 的进度由 0 到 1.0 之间的浮点数表示。

要设置进度,请调用:

[self.progressView setProgress:0.4 animated:YES];  
//progressView is an IBOutlet and @property defined in the header file, and instantiated in viewDidLoad  

The docs on using UIProgressView are pretty clear.

In your case, load up your first view controller from your app delegate, so that it is visible for displaying your UIProgressBar while the rest of the app loads.

Then begin the rest of the app data loading (whatever it may be).

The progress of a UIProgressView is represented by a float between 0 and 1.0.

To set the progress, call:

[self.progressView setProgress:0.4 animated:YES];  
//progressView is an IBOutlet and @property defined in the header file, and instantiated in viewDidLoad  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文