Quickie: viewWillAppear / viewWillDisappear

A reader writes:

When calling dismissModalViewControllerAnimated: in 4.2, the viewWillAppear method of the view about to appear will fire before the viewWillDisappear method of the view you are dismissing.

He’s right. In fact, I’ve tested this back to iOS 3.1.3 on a 3G, and the behavior is consistently as described. So, if you’re writing code for which the order of invocation of these methods matters, be careful. (Actually, it might be better to make your code insensitive to this ordering, since I don’t see anything in the documentation which guarantees one behavior or the other.)

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in iPhone. Bookmark the permalink.

Comments are closed.