首页 > 其他 > 详细

实现毛玻璃效果

时间:2016-01-20 20:50:02      阅读:182      评论:0      收藏:0      [点我收藏+]
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 1.1 创建UIImageView对象
    UIImageView *imageView = [[UIImageView alloc] init];
    // 1.2 设置imageView的frame
    imageView.frame = self.view.bounds;
    // 1.3 设置图片
    imageView.image = [UIImage imageNamed:@"1"];
    // 1.4 设置图片的内容模式
    imageView.contentMode = UIViewContentModeScaleAspectFill;

    // 1.5 设置毛玻璃
    UIToolbar *toolBar = [[UIToolbar alloc] init];
    toolBar.frame = imageView.bounds;
    // 1.6 设置工具栏的样式
    toolBar.barStyle = UIBarStyleBlack;
    // 1.7 设置透明度
    toolBar.alpha = 0.98;

    [imageView addSubview:toolBar];


    // 2.0 加入控制器的view中
    [self.view addSubview:imageView];
}

@end

 

实现毛玻璃效果

原文:http://www.cnblogs.com/521it/p/5146385.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!