Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
Created December 30, 2015 22:20
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Xamarin.iOS Blur screen with OnResignActivation
[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