首页 > 其他 > 详细

UI05_ 制造一个毛玻璃效果

时间:2015-08-12 21:42:32      阅读:287      评论:0      收藏:0      [点我收藏+]

首先,先创建一个UIImageView的对象.
注意, 本文已将ARC改为MRC.

UIImageView *imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"222.jpg"]];
    imageview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    [self.view addSubview:imageview];
    [imageview release];

第二步, 我们需要创建出一个毛玻璃效果.

    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];

第三步,创建一个毛玻璃视图,指定效果 — iOS8.0之后出现的效果.

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

第四步,设定视图的大小, 与viewControll的view同大, 因为imageView就是屏幕大.

effectView.frame = imageview.frame;

最后一步, 将效果视图加至imageView上.

 [imageview addSubview:effectView];

毛玻璃效果有三种.
UIBlurEffectStyleExtraLight,
UIBlurEffectStyleLight,
UIBlurEffectStyleDark

技术分享
技术分享
技术分享
技术分享

版权声明:本文为博主原创文章,未经博主允许不得转载。

UI05_ 制造一个毛玻璃效果

原文:http://blog.csdn.net/gao_zi/article/details/47450943

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!