美文网首页
ios毛玻璃

ios毛玻璃

作者: 40dd4b561abe | 来源:发表于2017-06-13 10:24 被阅读6次
    iOS 8 后更新的API,使用 UIBlurEffect 类和 UIVisualEffectView 类添加毛玻璃特效更加便捷,高效。
    
    //  创建显示图片UIImageView* imageView = [[UIImageViewalloc] init];/**  毛玻璃特效类型
    
    *  UIBlurEffectStyleExtraLight,
    
    *  UIBlurEffectStyleLight,
    
    *  UIBlurEffectStyleDark
    
    */UIBlurEffect* blurEffect = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleLight];//  毛玻璃视图
    
    UIVisualEffectView* effectView = [[UIVisualEffectViewalloc] initWithEffect:blurEffect];//添加到要有毛玻璃特效的控件中
    
    effectView.frame = imageView.bounds;[imageView addSubview:effectView];//设置模糊透明度effectView.alpha =.5f;
    

    相关文章

      网友评论

          本文标题:ios毛玻璃

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