When should you call ReleaseDesignerOutlets for a custom storyboard UI class when it's not a UIViewController and therefore doesn't have a ViewDidUnload method?
Fx. I have a custom UITableViewCell class, and want to release my outlets. I can see there is a protected void Dispose(bool disposing) method, but can't figure out if overriding this method is the correct way of doing it.
In absence of ViewDidUnload I'm releasing my outlets when my view controller is removed from the navigation stack. Which will only work when using a NavigationController or with PresentViewController. Parent will be null in that case.
public override void DidMoveToParentViewController(UIViewController parent)
{
base.DidMoveToParentViewController(parent);
if(parent == null && cleanupOnNavigationStackRemoval)
Cleanup();
}
protected void Cleanup()
{
CleanupBindings();
ReleaseOutlets();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With