Thanks for the answer I think my question now is a different one... I think maybe I was abusing ViewDidUnload all along!
If I have a uiviewcontroller that attaches to an application singleton for events - e.g. it attaches to a ChatServiceMonitor singleton and listens to incoming Chat events - then when can I unsubscribe from those events?Obviously I have to unsubscribe at some point - otherwise the viewcontroller can never be garbage collected. I used to use ViewDidUnload for this, although event this wasn't perfect as it didn't get called until a memory shortage happened. I guess what I'd really like is the equivalent of Android's OnDestroy() - that gives me the easiest place to hook in. But I'm currently guessing that an equivalent event isn't available at a general level in iOS, and so I'll have to do something somehow using ViewDidAppear and ViewDidDisappear, or maybe using the Delegate on the Navigation Controller. If anyone knows any obvious events I'm missing, then I'd be interested to know.... otherwise, I'll change the app behavior so it can use ViewDidAppear/ViewDidDisappear - should be easy enough to do. Stuart On 24 September 2012 10:03, Rolf Bjarne Kvinge <[email protected]> wrote: > > > On Sat, Sep 22, 2012 at 9:32 AM, Stuart Lodge <[email protected]> wrote: > >> I'm interested in what to do without ViewDidUnload too. >> > > Apple's recommendation is to handle memory warnings instead. > > Rolf > > >> >> Is there some other notification we should use to free up resources, >> unsubscribe from events, etc? >> >> E.g does Dispose get called when a viewpoint roller gets popped off the >> navigation stack? (Or when the memory warning arrives like viewdidunload >> used to?) >> >> Confused... >> >> Stuart >> >> // >> >> Very good questions! I was wondering about the ReleaseDesignerOutlets() >> as well. >> >> _______________________________________________ >> MonoTouch mailing list >> [email protected] >> http://lists.ximian.com/mailman/listinfo/monotouch >> >> >
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
