Created
December 30, 2015 22:20
-
-
Save dannycabrera/37566fdb65f56a1aaaa7 to your computer and use it in GitHub Desktop.
Xamarin.iOS Blur screen with OnResignActivation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Register ("AppDelegate")] | |
public partial class AppDelegate : UIApplicationDelegate | |
{ | |
UIVisualEffectView _blurView = null; | |
public override void OnActivated (UIApplication application) | |
{ | |
try { | |
if (_blurView != null) { | |
_blurView.RemoveFromSuperview (); | |
_blurView.Dispose (); | |
_blurView = null; | |
} | |
} catch {} | |
} | |
public override void OnResignActivation (UIApplication application) | |
{ | |
// Blur screen | |
using (var blurEffect = UIBlurEffect.FromStyle (UIBlurEffectStyle.Light)) { | |
_blurView = new UIVisualEffectView (blurEffect); | |
_blurView.Frame = _window.RootViewController.View.Bounds; | |
_window.RootViewController.View.AddSubview (_blurView); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment