iOS APP界面黑白化处理

APP界面黑白化处理比较简单的方式就是在UIView上加一个遮罩,我们定义了UKOverlayView来实现这一功能

@implementation UKOverlayView

- (instancetype)initWithFrame:(CGRect)frame {
    
    
    self = [super initWithFrame:frame];
    if (self) {
    
    
        [self setupInitialUI];
    }
    return self;
}

- (void)setupInitialUI {
    
    
    if (@available(iOS 13.0, *)) {
    
    
        self.translatesAutoresizingMaskIntoConstraints = false;
        self.backgroundColor = [UIColor lightGrayColor];
        self.layer.compositingFilter = @"saturationBlendMode";
        self.layer.zPosition = FLT_MAX;
    }
}

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    
    
    return nil;
}

@end

猜你喜欢

转载自blog.csdn.net/chennai1101/article/details/130013158
今日推荐