Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Lakario

macrumors member
Original poster
Oct 29, 2008
30
0
I currently have a ItemViewController that receives an object and I use that object in the viewDidLoad() method in order to populate the fields on the view. This works fine the first time I go to the view but if the user backs out, selects another Item from the RootViewController and then goes back into the ItemViewController, the viewDidLoad() event is never fired again.

Currently, I store the ItemViewController as a property within my RootViewController and reuse it in the cell click event. Should I instead create a new instance of the ItemViewController everytime they click a row, or is there a method I can use instead of viewDidLoad() that will be executed every time a view becomes the current screen?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Erm, well the page I linked to lists all the methods defined in UIViewController. You may need to check sub/super classes too...
 

Lakario

macrumors member
Original poster
Oct 29, 2008
30
0
So I noticed that with viewDidAppear and the push set to animated that there is some visual lag between the view rendering and the fields being updated accordingly. If I disable animation then the problem is not present, but it detracts from the user experience somewhat. Is there any way to make sure the user doesn't see the values being updated as the view slides into place?

Nevermind. I just found viewWillAppear(). Perfect.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
viewDidAppear probably only gets called once the animation is complete. viewWillAppear may well get called before the animations starts...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.