iPhone:如何在主视图控制器出现后*加载对象
好吧,希望这是一个简单的问题:
我有一个主视图控制器,它在应用程序启动时由应用程序委托加载。
这个视图控制器在“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果其他人也有类似的问题,我找到了一种解决方法:使用 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/.