OC_iOS8.0+毛玻璃效果

作者: KermitX | 来源:发表于2016-04-09 17:23 被阅读683次
    系统毛玻璃效果
    UIImageView * imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"testImg"]];  
    imageview.userInteractionEnabled = YES;  
    imageview.contentMode = UIViewContentModeScaleAspectFit;  
    imageview.frame = CGRectMake(0, 80, 200, 200);  
    [self.view addSubview:imageview];  
      
    UIBlurEffect * blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];  
    UIVisualEffectView * effectview = [[UIVisualEffectView alloc] initWithEffect:blur];  
    effectview.frame = CGRectMake(0, 0, imageview.frame.size.width, imageview.frame.size.height);  
    [imageview addSubview:effectview];  
      
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];  
    button.frame = CGRectMake(10, 50, 60, 60);  
    [button setTitle:@"btn" forState:UIControlStateNormal];  
    [effectview.contentView addSubview:button]; 
    

    相关文章

      网友评论

        本文标题:OC_iOS8.0+毛玻璃效果

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