模糊效果,使用FXBlurView这个第三方库可以很轻松的实现这一功能。
效果:
下面来看一下实现,ViewController.m
#import "ViewController.h" #import "FXBlurView.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UIImage *im = [UIImage imageNamed:@"changmen.jpg"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:im]; imageView.frame = CGRectMake(0, 0, im.size.width, im.size.height); [self.view addSubview:imageView]; FXBlurView *fxView = [[FXBlurView alloc] initWithFrame:CGRectMake(50, 0, 200, 200)]; fxView.dynamic = NO; fxView.blurRadius = 40; fxView.tintColor = [UIColor clearColor]; [self.view addSubview:fxView]; }
代码下载:http://pan.baidu.com/s/1o64w1YE
原文:http://blog.csdn.net/qqmcy/article/details/42030507