[Mono-bugs] [Bug 670294] AddSubview and Garbage collection
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Apr 21 16:33:43 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=670294
https://bugzilla.novell.com/show_bug.cgi?id=670294#c14
--- Comment #14 from Jonathan Clement <clementj at exactmodus.com> 2011-04-21 20:33:42 UTC ---
I detect view pop with a UINavigationControllerDelegate. Then, I check if the
UIViewController implements ICleanable: a custom interface with a single method
Clean. In the Clean method I just unregister with -= to any event.
In my case it seems to work because my viewcontroller's finalizer gets called.
But, since I cannot use mono 2.10 runtime's profiler (yet), I cannot be sure
100% that all my objects get cleaned up ...
class CustomNavigationControllerDelegate : UINavigationControllerDelegate
{
private UIViewController lastPushed;
private int lastControllerCount = 0;
public event Action<UIViewController> ViewControllerPopped;
public override void DidShowViewController (
UINavigationController navigationController,
UIViewController viewController,
bool animated)
{
int currentCount = navigationController.ViewControllers.Length;
if(currentCount < lastControllerCount && ViewControllerPopped != null ){
ViewControllerPopped(lastPushed);
}
lastControllerCount = currentCount;
lastPushed = viewController;
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list