昨天晚上突然心血来潮,研究了下ios 8的毛玻璃效果,觉得挺好看的。给人一种朦胧美,于是就动手实现了下代码。--- 对了飞鸟图的资源美审核通过大家不能下载了,非常抱歉。不过道理都是一样,图片哪里都有。最主要是把知识点掌握了。哈哈,那么我们就学习今天的毛玻璃效果吧。
#import "ViewController.h"
@interface ViewController ()
{
UIImageView *_imageView;
}
@end
@implementation ViewController
- ( void )viewDidLoad {
[ super viewDidLoad ];
[ self createView ];
[ self createvisualEfView ];
}
-( void )createView
{
UIImageView *imageView = [[ UIImageView alloc ] initWithFrame : CGRectMake ( 50 , 50 , 300 , 400 )];
[imageView setImage :[ UIImage imageNamed : @"webwxgetmsgimg.jpg" ]];
[ self . view addSubview :imageView];
_imageView = imageView;
}
// 创建可视化视图
-( void )createvisualEfView
{
UIVisualEffectView *vis =[[ UIVisualEffectView alloc ] initWithEffect :[ UIBlurEffect effectWithStyle : UIBlurEffectStyleExtraLight ]]; // 里面有三种方法可以拿来调用
vis. frame = CGRectMake ( 0 , 0 , 300 , 400 );
vis. alpha = 1.0 ;
[ _imageView addSubview :vis ];
}
这里面一共3种效果,大家可以去方法里面看,我们要有探索和冒险精神不是么。
原文:http://blog.csdn.net/wq820203420/article/details/43865243
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!