UIVisualEffectView

写一个模糊view,注意如果需在在此view上添加subView,需要使用visualEffectView的contentView添加

self.lightView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
    _lightView.frame = CGRectMake(20, 30, 200, 200);
    [self.imageView1 addSubview:_lightView];

    
    UILabel *label = [[UILabel alloc] init];
    label.text = @"Hello world";
    label.textColor = [UIColor blackColor];
    [_lightView.contentView addSubview:label];
    label.frame = CGRectMake(20, 20, 100, 30);

你可能感兴趣的:(UIVisualEffectView)