// DismissModalViewControllerAnimated can be called on on any controller in the hierarchy // note: if you dismiss something that is not in the hierarchy then you remove references to everything :( static void PopModal(UIViewController controller) { // handle the dismiss from the presenter // https://bugzilla.xamarin.com/show_bug.cgi?id=3489#c2 if (modal == null || (modal.Count == 0)) return; UIViewController pop = modal.Pop (); while (pop != controller && (modal.Count > 0)) { pop = modal.Pop (); } }
static void PushModal(UIViewController controller) { if (modal == null) modal = new Stack<UIViewController> (); modal.Push (controller); }