public AppLoadingHUD(UIViewController controller) { UIView view = UIViewControllersUtils.GetPresentedViewController().View; view.BackgroundColor = UIColor.Black; _hud = new MTMBProgressHUD(view) { RemoveFromSuperViewOnHide = true, BackgroundColor = UIColor.Black.ColorWithAlpha((float)0.7) }; _hud.Mode = MBProgressHUDMode.CustomView; _hud.DimBackground = false; _hud.Square = true; _hud.LabelText = @""; _hud.Color = UIColor.Clear; _hud.LabelColor = UIColor.Clear; view.AddSubview(_hud); UIImageView imageView = new UIImageView(CGRect.FromLTRB(0, 0, 45, 45)); var url = NSBundle.MainBundle.GetUrlForResource("loading", "gif", "Loading"); imageView.ContentMode = UIViewContentMode.ScaleAspectFit; imageView.SetImage(url); _hud.CustomView = imageView; _hud.Show(animated: true); }
/// <summary> /// Se navega al detalle del item /// </summary> void GotoDetail() { var controller = StoryBoardsFactory.App.InstantiateViewController("BookDetailsViewController") as BookDetailsViewController; controller.BookItem = Item; UIViewControllersUtils.GetCurrentNavigation()?.PushViewController(controller, true); }
/// <summary> /// Devuelve el Navigation Controller Actual /// </summary> /// <returns></returns> public static UINavigationController GetCurrentNavigation() { var viewController = UIViewControllersUtils.GetPresentedViewController() as UINavigationController; if (viewController != null) { return(viewController); } else { viewController = UIViewControllersUtils.GetPresentedViewController().PresentingViewController as UINavigationController; if (viewController != null) { return(viewController); } else { return(UIViewControllersUtils.GetPresentedViewController().NavigationController); } } }