Sjakelien
Sjakelien

Reputation: 341

Iphone delayed execution of code

[I just posted a similar question, but I'm not sure whether is actually got posted. Editor: please remove if this is a double post.]

The app that I'm writing has quite some code in the appdelegate's "applicationDidFinishLaunching" and a ViewController's "viewDidLoad". All of this code is executed before the user can start doing something with the app. In the mean time, the "default.png" is shown as a splash screen. This can take up to 10 seconds, which is I think unacceptably long. So I want some of the code to be executed, when the actual UI is already visible and accessible to the user. I don't want however that the user him/herself needs to push a refresh/continue button. Could anyone suggest me a way to minimize the startup time, and do this kind of post-poned execution? Thanks is advance, Sjakelien

Upvotes: 1

Views: 664

Answers (2)

Enyra
Enyra

Reputation: 17992

Perhaps you can use the viewDidFinishLoad delegate, but I'm not sure if it's still loaded within the "default image time" or afterwards.

Upvotes: 1

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81878

You can use NSObject's performSelector:withObject:afterDelay: from your applicationDidFinishLaunching to postpone part of your initialization.

Upvotes: 4

Related Questions