毛玻璃效果

2017-06-16  本文已影响0人  c_f
/*
     毛玻璃的样式(枚举)
     UIBlurEffectStyleExtraLight,
     UIBlurEffectStyleLight,
     UIBlurEffectStyleDark
     */
    UIImage* image = [UIImage imageNamed:@"agendaDefaultImg1001"];
    UIImageView *bgImgView = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-image.size.width)/2.0, (self.view.frame.size.height-image.size.height)/2.0, image.size.width, image.size.height)];
    bgImgView.image = image;
    [self.view addSubview:bgImgView];
    
    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
    effectView.frame = CGRectMake(0, 0, bgImgView.frame.size.width, bgImgView.frame.size.height);
    [bgImgView addSubview:effectView];
上一篇下一篇

猜你喜欢

热点阅读