开发者

iPhone: how to load objects *after* the main viewcontroller has appeared

开发者 https://www.devze.com 2023-02-01 04:17 出处:网络
Ok hopefully this is an easy question: I have a main viewcontroller that is loaded by the app delegate at application startup.

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!


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/.

0

精彩评论

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