2.UIImage+ImageEffects的模糊效果非常美觀; (比CoreImage中blurImage的模糊效果好)
3.修改過的UIImage+ImageEffects可以對圖片進行局部模糊。
效果實現:
//原碼網址:https://github.com/YouXianMing/UIImageBlur
// 導入文件:UIImage+ImageEffects.h和UIImage+ImageEffects.m
//1.導入頭文件:#import"UIImage+ImageEffects.h"
//原始圖片
UIImage *sourceImage = [UIImage imageNamed:@"normal"];
//對圖片進行處理(圖片渲染用時,應在子線程中,此處未做此處理)
UIImage *blurImage = [sourceImage blurImageAtFrame:CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height)];//設置frame可進行局部模糊
//加載圖片
UIImageView *imageView = [[UIImageView alloc]initWithImage:blurImage];
[self.view addSubview:imageView];