ios 毛玻璃效果

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view.

    self.view.backgroundColor=[UIColor whiteColor];


    [self.view addSubview:self.imageView];

    [self.view addSubview:self.effctView];


}

-(UIImageView *)imageView

{

    if (!_imageView ) {

        _imageView=[[UIImageView alloc]initWithFrame:self.view.bounds];

        _imageView.image=[UIImage imageNamed:@"1"];


    }


    return _imageView;

}

-(UIVisualEffectView *)effctView

{

    if (!_effctView) {

        _effctView=[[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];

        _effctView.frame=CGRectMake(0, 0, YHScreenWith, YHScreenHeight/2);

        _effctView.alpha=0.4;

    }

    return _effctView;

}



效果图

你可能感兴趣的:(ios 毛玻璃效果)