iOS 8 系统自带BlurEffect 毛玻璃特效

来源:互联网 发布:JAVA修改数组指定位置 编辑:程序博客网 时间:2024/05/22 03:53
UIBlurEffect 类是设定毛玻璃特效的类型,UIVisualEffectView类在创建时加入上一个类对象,剩下的跟普通的view 控件等用法就一样了:

   //  创建需要的毛玻璃特效类型

    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];

    //  毛玻璃view 视图

    UIVisualEffectView *effectView = [[UIVisualEffectView allocinitWithEffect:blurEffect];

    //添加到要有毛玻璃特效的控件中

    effectView.frame = self.imageV.bounds;

    [self.imageV addSubview:effectView];

    //设置模糊透明度

    effectView.alpha = .8f;


//判断系统版本号是否是iOS8以上
#define iOS8 [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0
1 0
原创粉丝点击