'FXBlurView', '~> 1.6.4'

发布时间:2020-07-20 02:03:17 作者:iOS技术者
来源:网络 阅读:646

/*

FXBlurView属性



@property (nonatomic, getter = isBlurEnabled) BOOL blurEnabled;

这个属性切换为个体FXBlurView实例模糊了。模糊是默认启用。注意,如果您使用+ setBlurEnabled方法禁用模糊那将会覆盖该设置。


@property (nonatomic, getter = isDynamic) BOOL dynamic;

这个属性控制是否FXBlurView更新动态,或者只有一次当视图添加到它的父视图。默认值为YES。注意,如果动态设置为不,你仍然可以迫使视图更新通过调用setNeedsDisplayupdateAsynchronously:completion:完成。动态模糊极其cpu密集型任务,因此你应该禁用动态视图立即执行一个动画之前,以避免卡顿。然而,如果你有多个FXBlurViews屏幕上那么简单的禁用更新使用setUpdatesDisabled方法而不是设置动态属性。


@property (nonatomic, assign) NSUInteger iterations;

模糊迭代的数量。更多的迭代改进了但质量降低了性能。默认为2的迭代。


@property (nonatomic, assign) NSTimeInterval updateInterval;

这个控件之间的时间间隔(以秒为单位)连续更新当FXBlurView在动态模式下操作。这个默认为0,这意味着FXBlurView将尽快更新。这收益最好的帧速率,但也很耗CPU, 这可能导致应用程序的其他性能降低,尤其是在旧设备。要实现这一点,试着增加updateInterval的数值。


@property (nonatomic, assign) CGFloat blurRadius;

这个属性控制模糊效果的半径()。默认为40点的半径,这是类似于iOS 7模糊效果。


@property (nonatomic, strong) UIColor *tintColor;

这在一个可选的色调颜色应用于FXBlurView。颜色的RGB分量将混合模糊图像,导致温和的色彩。不同色彩的强度效应,使用光明或黑暗的颜色。对tintColor透明度(alpha)的设置会被忽略。如果您不希望应用色彩,将这个值设置为零或(用户界面颜色clearColor]。请注意,如果您正在使用Xcode 5以上,FXBlurViews接口中创建默认构建器将有一个蓝色的色调。


@property (nonatomic, weak) UIView *underlyingView;

这个属性指定视图FXBlurView将示例创建模糊效果。如果设置为零(默认),这将是模糊视图的父视图本身,但你可以重写它如果你需要的话。

*/


FXBlurViewUIView的子类,它实现毛玻璃效果的原理其实就是覆盖上一层FXBlurView的实例对象。

    

    - (void)viewDidLoad {

        

        [super viewDidLoad];

        

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

        

        p_w_picpathView.p_w_picpath = [UIImage p_w_picpathNamed:@"Default-Port-hd47"];

        

        [self.view addSubview:p_w_picpathView];

        

        FXBlurView * aview = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

        

        aview.tintColor = [UIColor whiteColor];  //前景颜色

        

        aview.blurRadius = 20.0;                 //模糊半径

        

        aview.dynamic = YES;                     //动态改变模糊效果

        

        [self.view addSubview:aview];

        

        FXBlurView * bview = [[FXBlurView alloc] initWithFrame:CGRectMake(0, 120, 100, 100)];

        

        bview.tintColor = [UIColor whiteColor];  //前景颜色

        

        bview.blurEnabled = YES;                //是否允许模糊,默认YES

        

        bview.blurRadius = 10.0;               //模糊半径

        

        bview.dynamic = YES;                   //动态改变模糊效果

        

        bview.iterations = 2;                  //迭代次数:

        

        bview.updateInterval = 2.0;            //更新时间(不确定具体功能)

        

        /*

         

         blurRadius 1.0 && dynamic 100 的效果和 blurRadius 10.0 && dynamic 1的效果大致相同

         

         */

        

        [self.view addSubview:bview];

        

        FXBlurView * cview = [[FXBlurView alloc] initWithFrame:CGRectMake(150, 0, 200, 200)];

        

        cview.blurRadius = 20.0;

        

        cview.tintColor = [UIColor whiteColor];

        

        [self.view addSubview:cview];

        

}



/////////////////////////////////////////


使用的代码片段:


class LeftViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {


    var backgroundImageView:UIImageView?

    var frostedView = FXBlurView()

    

    fileprivate var _tableView :UITableView!

    fileprivate var tableView: UITableView {

        get{

            if(_tableView != nil){

                return _tableView!;

            }

            _tableView = UITableView();

            _tableView.backgroundColor = UIColor.clear

            _tableView.estimatedRowHeight=100;

            _tableView.separatorStyle = UITableViewCellSeparatorStyle.none;

            

            regClass(self.tableView, cell: LeftUserHeadCell.self)

            regClass(self.tableView, cell: LeftNodeTableViewCell.self)

            regClass(self.tableView, cell: LeftNotifictionCell.self)

            

            _tableView.delegate = self;

            _tableView.dataSource = self;

            return _tableView!;

            

        }

    }

    

    override func viewDidLoad() {

        super.viewDidLoad()

        self.view.backgroundColor = V2EXColor.colors.v2_backgroundColor;

        

        self.backgroundImageView = UIImageView()

        self.backgroundImageView!.frame = self.view.frame

        self.backgroundImageView!.contentMode = .scaleToFill

        view.addSubview(self.backgroundImageView!)

        

         //这个属性指定视图FXBlurView将示例创建模糊效果。如果设置为零(默认),这将是模糊视图的父视图    本身,但你可以重写它如果你需要的话。

        frostedView.underlyingView = self.backgroundImageView!


        frostedView.isDynamic = false

        frostedView.tintColor = UIColor.black

        frostedView.frame = self.view.frame

        self.view.addSubview(frostedView)

        

        self.view.addSubview(self.tableView);

        self.tableView.snp.makeConstraints{ (make) -> Void in

            make.top.right.bottom.left.equalTo(self.view);

        }

        



附件:http://down.51cto.com/data/2366604
推荐阅读:
  1. 怎样选择租用网站服务器
  2. 怎么在windows系统中动态修改ip

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

fxblur view' blur

上一篇:网页布局--瀑布流

下一篇:5-华为防火墙:二层和三层接入的安全策略配置差异

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》