代码实现
- (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]; }
效果对比
时间: 2024-09-29 00:17:38