Hi, I hope you can help resolve my fuzziness regarding what should be released in viewDidUnload (as caused by a Low Memory Warning) and what not.
To my eye, the following view controllers are conceptually identical:
CurrentTimeViewController, where the timeLabel is defined in the xib and connected to the controller there. I can not see any place in the view controller, where the timeLabel is retained explicitly another time. Yet it is claimed in this chapter that the label is retained by the subview (that I can see) AND the view controller. As it is, the code is working after a memory warning. So even though I don’t understand how, I’ll just assume for now, that this is right. But that gives me problems understanding…
… my MapViewController, which is my solution to the challenge and basically the implementation of Whereami put into a controller, with the MapPlace classes and xib included. On its own and without any code in viewDidUnload, this runs just fine. However, going by the rules that seemed to apply to CurrentTimeViewController, I’ll now just go ahead and try to release an UI item in viewDidUnload:
[locationManager release]; // This seems to work, it’s just recreated when needed
Go to another Tab, create a memory warning, try to switch back to the map, BOOM!
Program received signal: “EXEC_BAD_ACCESS”
So why doesn’t this work here? I see no conceptual difference in how both view controllers retain their UI items.