制作毛玻璃效果

时间:2017-08-05 17:35:22   收藏:0   阅读:176
 //加入一个图片
    UIImageView *imageview = [[UIImageView alloc]init];
    imageview.frame = CGRectMake(10, 100, 300, 300);
    
    imageview.contentMode = UIViewContentModeScaleAspectFit;
    
    imageview.userInteractionEnabled = YES;
    
    imageview.image = [UIImage imageNamed:@"3.jpg"];
    
    [self.view addSubview:imageview];
    
    //模糊效果代码
   UIBlurEffect *errect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];


    UIVisualEffectView *ectView = [[UIVisualEffectView alloc]initWithEffect:errect];
    ectView.alpha = 0.6;
    
   ectView.frame = CGRectMake(0, 0, imageview.frame.size.width/2, 300);
    
    
    [imageview addSubview:ectView];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
    
    btn.frame =CGRectMake(10,50, 100, 40);
    [btn setTitle:@"btn"forState:UIControlStateNormal];
    [ectView.contentView addSubview:btn];

原文:http://www.cnblogs.com/liguangsunls/p/7290620.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!