Objective-c – iPhone viewDidAppear stops firing after loading/dismissing a modal view

iphoneobjective c

I'm starting to go a little crazy with this one.

I have an iphone application with a somewhat complex view structure it is a tabbed application with either a view controller or a navigation controller on each tab.

The main controller for one tab uses the viewDidAppear callback to reload any data that has been modified since the last time it was displayed and this behaves fine in most cases. The issue I have run into is that when I navigate in subviews(within the same tab) using the standard navigation controller push/pop mechanism the viewWillAppear and viewDidAppear on the main view always fire when I navigate back to it.
However if I load a modal view controller and then dismiss it, the viewWillAppear continues to fire but the viewDidAppear stops firing.

I am almost certain that this is tied to the need to manually call these callbacks on the modal controller but I cannot find the reference info on how to do this correctly. (I only see this viewDidAppear bug on the hardware, in the simulator it works as I'd expect)

If you need further clarification let me know and thanks for any input.

Best Answer

Yes, this is how it works. You are better off switching to using viewWillAppear.

This has the added advantage of updating the data before the screen is redrawn.

Related Topic