Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
Created December 30, 2015 22:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dannycabrera/37566fdb65f56a1aaaa7 to your computer and use it in GitHub Desktop.
Save dannycabrera/37566fdb65f56a1aaaa7 to your computer and use it in GitHub Desktop.
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