コード例 #1
0
        // Obscure UI in multitasking view
        public override void OnResignActivation(UIApplication uiApplication)
        {
            base.OnResignActivation(uiApplication);

            // Prevent taking snapshot
            uiApplication.IgnoreSnapshotOnNextApplicationLaunch();

            // Create our hiding view which is transparent initially. Also note the tag I'm giving the view. Why 42 you ask..?
            // For this example let's just use a Xamarin Blue background color
            var bgView = new UIView(uiApplication.KeyWindow.Frame)
            {
                Tag = 42, Alpha = 0, BackgroundColor = Color.FromHex("#449CD5").ToUIColor()
            };

            // Add the view to our current window
            uiApplication.KeyWindow.AddSubview(bgView);
            uiApplication.KeyWindow.BringSubviewToFront(bgView);

            // Animate it to the front and thus hide the contents of the app
            UIView.Animate(0.5, () =>
            {
                bgView.Alpha = 1;
            });
        }