几行代码搞定图片模糊模式

- (void)viewDidLoad {

    [super viewDidLoad];

    

    // 做图片

        UIImageView *myImgView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];

         myImgView.image = [UIImage imageNamed:@"A2D368D0CE416A120C9A4411C1B721CA.png"];

         [self.view addSubview:myImgView];

         //添加模糊效果

         UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];

    //三种效果  UIBlurEffectStyleDark UIBlurEffectStyleExtraLight  UIBlurEffectStyleLight

         UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];

         effectView.frame = [UIScreen mainScreen].bounds;

         [myImgView addSubview:effectView];

    // Do any additional setup after loading the view, typically from a nib.

}

posted @ 2016-03-09 11:50  ios攻城狮  阅读(232)  评论(0编辑  收藏  举报