public override void ViewWillDisappear (bool animated) { var a = iOSUtils.GetActionOnView(this); if(a == iOSUtils.ViewOperation.Popped) { } else if(a == iOSUtils.ViewOperation.Pushed) { } base.ViewWillDisappear (animated); } public class iOSUtils { public enum ViewOperation { Pushed, Popped, Unknown } public static ViewOperation GetActionOnView(UIViewController viewController) { var viewControllers = viewController.NavigationController.ViewControllers; if(viewControllers.Length > 1 && viewControllers[viewControllers.Length-2] == viewController){ return ViewOperation.Pushed; } else if(!viewControllers.Contains(viewController)){ return ViewOperation.Popped; } return ViewOperation.Unknown; } }
Saturday, July 14, 2012
How to determine if an iOS view is pushed or popped with MonoTouch
This is a translation from Objective C to C# of the stackoverflow answer for:
viewWillDisappear: Determine whether view controller is being popped or is showing a sub-view controller
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment