/**

*  背景模糊化效果

*/

- (void)resetBlurView

{

ANBlurredImageView *blurView = self.commentBackground; // 创建ANBlurredImageView类型的属性

blurView.baseImage = [self screenShots];

blurView.blurAmount = 0.3; // 设置透明度

__weak typeof (self) weakP = self;

BLOCK_BACKGROUND(^() {

[blurView generateBlurFramesWithCompletion:^{

BLOCK_MAIN_THREAD(^() {

[weakP showBackgroundViewAnimation:YES];

});

}];

});

}

-(UIImage *)screenShots

{

CGSize imageSize = [[UIScreen mainScreen] bounds].size;

UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);

CGContextRef context = UIGraphicsGetCurrentContext();

for (UIWindow * window in [[UIApplication sharedApplication] windows]) {

if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) {

CGContextSaveGState(context);

CGContextTranslateCTM(context, [window center].x, [window center].y);

CGContextConcatCTM(context, [window transform]);

CGContextTranslateCTM(context, -[window bounds].size.width*[[window layer] anchorPoint].x, -[window bounds].size.height*[[window layer] anchorPoint].y);

[[window layer] renderInContext:context];

CGContextRestoreGState(context);

}

}

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return image;

}

- (void)showBackgroundViewAnimation:(BOOL)show

{

__weak typeof (self) weakP = self;

if (show) {

weakP.commentBackground.hidden = NO;

[weakP.commentBackground blurInAnimationWithDuration:self.keyboardAppear];

} else {

[weakP.commentBackground blurOutAnimationWithDuration:self.keyboardAppear completion:^{

weakP.commentBackground.hidden = YES;

}];

}

}

转载于:https://www.cnblogs.com/youmei11/p/4769488.html

iOS 模糊化效果 ANBlurredImageView的使用相关推荐

  1. [纪录]仿IOS滚轮效果(竖直滑动选择器)

    今天想做一个类似这样的一个效果,可是UI的模板是参考IOS做的,于是就各种百度各种搜,最后让我找到了一个仿IOS滚轮的一个Demo,稍微研究了一下,发上来,大家一起学习,以后也方便我查看,就不用再去百 ...

  2. 【转】提示框第三方库之MBProgressHUD iOS toast效果 动态提示框效果

    原文网址:http://www.zhimengzhe.com/IOSkaifa/37910.html MBProgressHUD是一个开源项目,实现了很多种样式的提示框,使用上简单.方便,并且可以对显 ...

  3. android 背景毛玻璃模糊化效果实现方法

    最近做项目有这样的需求: 在activity中启动一个dialog时, 启动的dialog的背景设为启动acitivity的模糊化图片. 实现思路: 1. 截屏, 获取当前activity的界面 2. ...

  4. vue中禁止ios橡皮筋效果(亲测有效)

    相信有很多前端的朋友都遇到过这个问题,这个问题真的很头疼.ios的橡皮筋效果会带来一些莫名其妙的bug.如果直接对body禁止的话,那整个页面都无法滑动了.所以我今天带来一个解决方案.原博客找不到了, ...

  5. android 按钮回弹效果,Android仿IOS回弹效果 支持任何控件

    本文实例为大家分享了Android仿IOS回弹效果的具体代码,供大家参考,具体内容如下 效果图: 导入依赖: dependencies { // ... compile 'me.everything: ...

  6. android 布局回弹,Android仿IOS回弹效果 支持任何控件

    本文实例为大家分享了Android仿IOS回弹效果的具体代码,供大家参考,具体内容如下 效果图: 导入依赖: dependencies { // ... compile 'me.everything: ...

  7. android 仿ios毛玻璃,类 iOS 毛玻璃效果控件 BlurView

    软件介绍 BlurView 是Android下类似 iOS 毛玻璃效果控件. 使用: android:id="@+id/blurView" android:layout_width ...

  8. 解决IOS橡皮筋效果

    1.一棍子打死 (全部滚动条失效) app.vue文件mounted中 document.body.addEventListener('touchmove', function (e) {e.prev ...

  9. Swift iOS : 模糊化

    iOS的模糊化,会让界面很炫酷,用了不能停.本案例使用了FXBlurView,对图片进行模糊处理. 使用Pod文件: target 'five' douse_frameworks!pod 'FXBlu ...

最新文章

  1. php使用workerman实战,使用workerman实现在线聊天的方法
  2. 洛谷P1265 公路修建
  3. HackerRank Gift Boxes(hash)
  4. Silverlight+WCF 实战-网络象棋最终篇之非线程阻塞倒计时窗口(四)
  5. 087-把PHP数组中的元素按随机顺序重新排列shuffle
  6. 参数详解 复制进程_如何优化PostgreSQL逻辑复制
  7. 7价 半导体掺杂_掺杂工艺(一)
  8. PowerPoint笔记(四)
  9. 20171129-构建之法:现代软件工程-阅读笔记
  10. wget mirror
  11. VS清理中间文件bat脚本
  12. 正则表达式详解及示例
  13. CPU内部原理,一文解析
  14. 精读解析 Entire Space Multi-Task Model(ESMM) 阿里2018年CVR预测
  15. 本科英语计算机,计算机本科生英语简历范文
  16. 小象学院 nlp 自然语言处理项目实战
  17. 3年试点即将到期,电子印章将成网络货运新动力
  18. 日本标点符号的输入总结
  19. Android 人民币符号少一横问题解决方案
  20. mysql与pg的主键索引说明

热门文章

  1. 实用的 GitHub 仓库搜索技巧
  2. mysql的存储过程原理_mysql存储过程原理与用法详解
  3. 微软Windows 11正式发布!一文带你了解免费升级方法、最低系统要求
  4. 实际场景中,云原生存储面临的 7 个挑战
  5. Kubernetes 下零信任安全架构分析
  6. Serverless 实战——使用 Rendertron 搭建 Headless Chrome 渲染解决方案
  7. html怎么显示直线,html怎么用鼠标画出一条直线,鼠标移动时候要能看到线条
  8. 文件管理器android实现,Android开发之简单文件管理器实现方法
  9. android 7.0 更新apk,Android更新apk兼容7.0和8.0
  10. html中实现th标签添加分页,html – 如何在Angular 4中为表添加分页?