ios 毛玻璃效果

作者: 江河_ios | 来源:发表于2018-02-01 14:55 被阅读18次

    - (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 毛玻璃效果

        本文链接:https://www.haomeiwen.com/subject/mlpdzxtx.html