iOS 模糊化效果 ANBlurredImageView的使用
/**
* 背景模糊化效果
*/
- (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的使用相关推荐
- [纪录]仿IOS滚轮效果(竖直滑动选择器)
今天想做一个类似这样的一个效果,可是UI的模板是参考IOS做的,于是就各种百度各种搜,最后让我找到了一个仿IOS滚轮的一个Demo,稍微研究了一下,发上来,大家一起学习,以后也方便我查看,就不用再去百 ...
- 【转】提示框第三方库之MBProgressHUD iOS toast效果 动态提示框效果
原文网址:http://www.zhimengzhe.com/IOSkaifa/37910.html MBProgressHUD是一个开源项目,实现了很多种样式的提示框,使用上简单.方便,并且可以对显 ...
- android 背景毛玻璃模糊化效果实现方法
最近做项目有这样的需求: 在activity中启动一个dialog时, 启动的dialog的背景设为启动acitivity的模糊化图片. 实现思路: 1. 截屏, 获取当前activity的界面 2. ...
- vue中禁止ios橡皮筋效果(亲测有效)
相信有很多前端的朋友都遇到过这个问题,这个问题真的很头疼.ios的橡皮筋效果会带来一些莫名其妙的bug.如果直接对body禁止的话,那整个页面都无法滑动了.所以我今天带来一个解决方案.原博客找不到了, ...
- android 按钮回弹效果,Android仿IOS回弹效果 支持任何控件
本文实例为大家分享了Android仿IOS回弹效果的具体代码,供大家参考,具体内容如下 效果图: 导入依赖: dependencies { // ... compile 'me.everything: ...
- android 布局回弹,Android仿IOS回弹效果 支持任何控件
本文实例为大家分享了Android仿IOS回弹效果的具体代码,供大家参考,具体内容如下 效果图: 导入依赖: dependencies { // ... compile 'me.everything: ...
- android 仿ios毛玻璃,类 iOS 毛玻璃效果控件 BlurView
软件介绍 BlurView 是Android下类似 iOS 毛玻璃效果控件. 使用: android:id="@+id/blurView" android:layout_width ...
- 解决IOS橡皮筋效果
1.一棍子打死 (全部滚动条失效) app.vue文件mounted中 document.body.addEventListener('touchmove', function (e) {e.prev ...
- Swift iOS : 模糊化
iOS的模糊化,会让界面很炫酷,用了不能停.本案例使用了FXBlurView,对图片进行模糊处理. 使用Pod文件: target 'five' douse_frameworks!pod 'FXBlu ...
最新文章
- php使用workerman实战,使用workerman实现在线聊天的方法
- 洛谷P1265 公路修建
- HackerRank Gift Boxes(hash)
- Silverlight+WCF 实战-网络象棋最终篇之非线程阻塞倒计时窗口(四)
- 087-把PHP数组中的元素按随机顺序重新排列shuffle
- 参数详解 复制进程_如何优化PostgreSQL逻辑复制
- 7价 半导体掺杂_掺杂工艺(一)
- PowerPoint笔记(四)
- 20171129-构建之法:现代软件工程-阅读笔记
- wget mirror
- VS清理中间文件bat脚本
- 正则表达式详解及示例
- CPU内部原理,一文解析
- 精读解析 Entire Space Multi-Task Model(ESMM) 阿里2018年CVR预测
- 本科英语计算机,计算机本科生英语简历范文
- 小象学院 nlp 自然语言处理项目实战
- 3年试点即将到期,电子印章将成网络货运新动力
- 日本标点符号的输入总结
- Android 人民币符号少一横问题解决方案
- mysql与pg的主键索引说明
热门文章
- 实用的 GitHub 仓库搜索技巧
- mysql的存储过程原理_mysql存储过程原理与用法详解
- 微软Windows 11正式发布!一文带你了解免费升级方法、最低系统要求
- 实际场景中,云原生存储面临的 7 个挑战
- Kubernetes 下零信任安全架构分析
- Serverless 实战——使用 Rendertron 搭建 Headless Chrome 渲染解决方案
- html怎么显示直线,html怎么用鼠标画出一条直线,鼠标移动时候要能看到线条
- 文件管理器android实现,Android开发之简单文件管理器实现方法
- android 7.0 更新apk,Android更新apk兼容7.0和8.0
- html中实现th标签添加分页,html – 如何在Angular 4中为表添加分页?