Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #import "AppDelegate.h"
  2.  
  3. @interface AppDelegate ()
  4. @property (nonatomic, strong) UIVisualEffectView *effectView;
  5.  
  6. @end
  7.  
  8. @implementation AppDelegate
  9.  
  10.  
  11. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  12. // Override point for customization after application launch.
  13. UIVisualEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
  14. self.effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
  15. self.effectView.frame = self.window.bounds;
  16. self.effectView.alpha = 0;
  17. return YES;
  18. }
  19.  
  20.  
  21. - (void)applicationWillResignActive:(UIApplication *)application {
  22. [self.window addSubview:self.effectView];
  23. [UIView animateWithDuration:0.5 animations:^{
  24. self.effectView.alpha = 1;
  25. } completion:^(BOOL finished) {
  26.  
  27. }];
  28. }
  29.  
  30. - (void)applicationDidBecomeActive:(UIApplication *)application {
  31. [UIView animateWithDuration:0.3 animations:^{
  32. self.effectView.alpha = 0;
  33. } completion:^(BOOL finished) {
  34. [self.effectView removeFromSuperview];
  35. }];
  36. }
  37.  
  38.  
  39. - (void)applicationWillTerminate:(UIApplication *)application {
  40. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  41.  
  42. }
  43.  
  44.  
  45. @end
Add Comment
Please, Sign In to add comment