private void RemoveWindow() { _hudWindow.ResignKeyWindow(); _hudWindow = null; // Return focus to the first window UIApplication.SharedApplication.Windows[0].MakeKeyWindow(); }
public void Show() { _hudWindow = _hudWindow ?? CustomWindow.DefaultWindow; _hudWindow.Alpha = 0.0f; this.Alpha = 0.0f; _hudWindow.AddSubview(this); _hudWindow.MakeKeyAndVisible(); UIView.BeginAnimations(@"SSHUDViewFadeInWindow"); _hudWindow.Alpha = 1.0f; UIView.CommitAnimations(); var windowSize = _hudWindow.Frame.Size; var contentFrame = new RectangleF((float)Math.Round((windowSize.Width - _hudSize.Width) / 2.0f), (float)Math.Round((windowSize.Height - _hudSize.Height) / 2.0f) + 10.0f, _hudSize.Width, _hudSize.Height); var offset = 20.0f; if (Util.IsPortrait()) { this.Frame = new RectangleF(contentFrame.X, contentFrame.Y + offset, contentFrame.Width, contentFrame.Height); } else { this.Frame = new RectangleF(contentFrame.X + offset, contentFrame.Y, contentFrame.Width, contentFrame.Height); } UIView.BeginAnimations(@"SSHUDViewFadeInContentAlpha"); UIView.SetAnimationDelay(0.1f); UIView.SetAnimationDuration(0.2f); this.Alpha = 1.0f; UIView.CommitAnimations(); UIView.BeginAnimations(@"SSHUDViewFadeInContentFrame"); UIView.SetAnimationDelay(0.1f); UIView.SetAnimationDuration(0.3f); this.Frame = contentFrame; UIView.CommitAnimations(); }