码迷,mamicode.com
首页 > 移动开发 > 详细

ios8下添加高斯模糊、ios7创建快照

时间:2015-06-14 16:39:59      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

1.

UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"IMG_0004"]];
    imageView.frame = CGRectMake(0, 0,320, 720);
    [self.view addSubview:imageView];
    //ios8下添加高斯模糊,模糊有3种类型
    UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
    effectView.frame = CGRectMake(0, 100, 320, 100);
    [imageView addSubview:effectView];
    //
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
    btn.frame = CGRectMake(10, 50, 100, 40);
    btn.backgroundColor = [UIColor cyanColor];
    [btn setTitle:@"btn" forState:UIControlStateNormal];
    [effectView.contentView addSubview:btn];

 2.

UIImageView    *showView         = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    showView.image = [UIImage imageNamed:@"IMG_0003"];
    [self.view addSubview:showView];
    
    // 截取的view,设置NO透明度为0,Yes透明度为1
    UIView *snap1 = [showView snapshotViewAfterScreenUpdates:NO];
    snap1.center  = self.view.center;
    [self.view addSubview:snap1];
    NSLog(@"alpha=%f",snap1.alpha);

 

ios8下添加高斯模糊、ios7创建快照

标签:

原文地址:http://www.cnblogs.com/huen/p/4527952.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!