首页 > 其他 > 详细

UIVisualEffectView(高斯模糊效果)

时间:2017-05-12 09:16:35      阅读:369      评论:0      收藏:0      [点我收藏+]
   ///高斯模糊。
   UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; tempView.backgroundColor = [UIColor yellowColor]; [self.view addSubview:tempView]; ///UIBlurEffectStyleExtraLight聚光灯效果。UIBlurEffectStyleLight效果轻。UIBlurEffectStyleDark效果重。 UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; effectView.frame = CGRectMake(100, 100, 100, 100); ///作用对tempView做高斯模糊效果。 [self.view addSubview:effectView];

将UIBackgroundTaskIdentifier设置为UIBackgroundTaskInvalid即后台任务已关闭。

 1 - (void)applicationDidEnterBackground:(UIApplication *)application {
 2     //由于要取消后台任务,所以需要后台任务标识符 。
 3     _identifier = [application beginBackgroundTaskWithExpirationHandler:^{
 4           [self endTask]; // 如果在系统规定时间内任务还没有完成,在时间到之前会调用到这个方法,一般是10分钟
 5     }];
 6     
 7     [self performSelector:@selector(endTask) withObject:self afterDelay:120];
 8 }
 9 
10 - (void)endTask{
11     [[UIApplication sharedApplication] endBackgroundTask:_identifier];
12     _identifier = UIBackgroundTaskInvalid;
13 }

 

UIVisualEffectView(高斯模糊效果)

原文:http://www.cnblogs.com/jisa/p/6843869.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!