views:

40

answers:

3

hi, when i load my viewController i used "viewDidLoad"method to init my view ,but this take much time to make the view appeared .So i had the idea to use "viewDidAppear" method to accelerate the appearance of my view but the load of the informations about my view are now loaded to the memory every time that i push my view (which is normal) or i pop to it(and there is my problem) Have you an idea?

A: 

Create a background task that is started in viewDidLoad and just updates the GUI when it's finished. This should at least let you show the GUI, but possibly without valid data.

willcodejavaforfood
this is what i did but the view takes fiew seconds (3,4) to be appearred (i created a thread to parse an xml file)
Dingua
A: 

According to the View Controller Programming Guide, you are supposed to create your view in the loadView method :

If you prefer to create views programmatically, instead of using a nib file, you do so from your view controller’s loadView method. You must override this method if you plan to create your views programmatically.

Maybe you should create your view in the loadView method and then load extra data in the viewDidLoad as explained in Understanding the View Management Cycle, using a background task as suggested by willcodejavaforfood if necessary.

David
i will try this,thk you
Dingua
i tried it but it didn't change anything
Dingua
A: 

i did it with the method "ViewDidAppear:animated" and for the problem of loading data for every appearance i deal with it with a test on the top of the mehod:

if(data==nil){/*i do ...*/}

and for me data was an array that i am writing on when loading the view

Dingua