iPhone:如何在主视图控制器出现后*加载对象

发布于 2024-10-09 06:06:50 字数 424 浏览 0 评论 0原文

好吧,希望这是一个简单的问题:

  • 我有一个主视图控制器,它在应用程序启动时由应用程序委托加载。

  • 这个视图控制器在“viewDidLoad”中有一些代码来创建一些基于非视图类型的对象(一些声音/数据对象)。除此之外它还加载一个 UIView。

  • 创建声音/数据对象需要一段时间,但应用程序在没有它们的情况下也能正常工作 - 所以我想在 UIView 加载后加载这些对象,但似乎不知道如何加载。< /p>

  • 我尝试将适当的代码移动到 viewDidAppear,但是在 UIView 实际出现在屏幕上之前仍然会调用它。是否有一个函数在视图控制器实际开始显示 UIViews 之后被调用,或者以任何其他方式来实现我想要的?

任何帮助将不胜感激 - 谢谢!

Ok hopefully this is an easy question:

  • I have a main viewcontroller that is loaded by the app delegate at application startup.

  • This viewcontroller has some code in 'viewDidLoad' to create some non view type based objects (some sound/data objects). Aside from that it also loads a UIView.

  • The sound/data objects take a while to create, but the app is quite functional without them for a start - so I want to load these objects after the UIView has loaded, but can't seem to figure out how.

  • I have tried moving the appropriate code to viewDidAppear, but this is still called before the UIView actually appears on screen. Is there a function that is called after the viewcontroller actually starts displaying UIViews, or any other way to achieve what I want?

Any help would be much appreciated - thanks!

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

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

发布评论

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

评论(1

牵强ㄟ 2024-10-16 06:06:50

如果其他人也有类似的问题,我找到了一种解决方法:使用 NSThread 在后台加载内容,而无需暂停其他所有内容。

这里有一个很好的简单示例:http://www.iphoneexamples.com/

In case anyone else has a similar problem, I found a way to solve it: use NSThread to load things in the background without pausing everything else.

There's a good simple example here: http://www.iphoneexamples.com/.

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