iOS APP interface black and white processing

The simpler way to black and white the APP interface is to UIViewadd a mask on it. We have defined it UKOverlayViewto realize this function

@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

Guess you like

Origin blog.csdn.net/chennai1101/article/details/130013158