Re: ARC refactor misses IBOutlets?
Re: ARC refactor misses IBOutlets?
- Subject: Re: ARC refactor misses IBOutlets?
- From: Quincey Morris <email@hidden>
- Date: Sat, 27 Oct 2012 16:29:02 -0700
In this way, -viewDidLoad and -viewDidUnload are nicely symmetrical (although I've experienced other asymmetries between them).
So, in iOS 6, -viewDidUnload is no longer called, so any work one might've done there is never being done (say, removing observers or invalidating timers). I'm disappointed there's no way for the compiler to warn me. I sure don't recall reading about this change, but it seems quite severe.
One of the problems with the old way is they're *not* symmetric as typically used. "Load" in these method names refers to the loading of resource (i.e. the nib containing the view). 'viewDidLoad' often gets used as "the place to put things when the view is initially created" -- because the view is initially created just after the nib is loaded.
'viewDidUnload' means the time when the nib is removed from memory, and has nothing directly to do with the lifetime of the view. So if you need to tear down observers etc, a different method is better -- either viewDidDisappear or dealloc, for example. David's point is that examination of code patterns showed that there really isn't anything that properly belongs in 'viewDidUnload' that can't be moved elsewhere, and many apps were incorrectly putting code in 'viewDidUnload' that should have been elsewhere. (In the latter case, the problem might never show up, because it would only matter in a severely contained memory environment.)
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden