iOS8使用UIVisualEffectView实现模糊效果

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    //使用图片初始化背景色 
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"gradient2"]]; 
    //实现模糊效果 
    UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; 
    visualEffectView.frame = self.view.bounds; 
    visualEffectView.alpha = 1.0; 
    [self.view addSubview:visualEffectView]; 
}
posted @ 2015-07-26 00:21  needly  阅读(229)  评论(0编辑  收藏  举报