ios8新特性之毛玻璃效果

直接上代码

 UIView *myView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    myView.backgroundColor  = [UIColor redColor];
    [self.view addSubview:myView];
    
    //承载毛玻璃的底面
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    
    //毛玻璃效果
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blur];
    effectView.frame = CGRectMake(0, 0, 300, self.view.frame.size.height);
    [myView addSubview:effectView];

  怎么样? 是不是比较简单呢 ?

posted @ 2015-02-22 10:08  Mr.Greg  阅读(267)  评论(0编辑  收藏  举报