ios 应用特殊节日页面整体变灰

        //获取RGBA颜色数值
        CGFloat r,g,b,a;
        [[UIColor lightGrayColor] getRed:&r green:&g blue:&b alpha:&a];
        //创建滤镜
        id cls = NSClassFromString(@"CAFilter");
        id filter = [cls filterWithName:@"colorMonochrome"];
        //设置滤镜参数
        [filter setValue:@[@(r),@(g),@(b),@(a)] forKey:@"inputColor"];
        [filter setValue:@(0) forKey:@"inputBias"];
        [filter setValue:@(1) forKey:@"inputAmount"];
        //设置给window
        window.layer.filters = [NSArray arrayWithObject:filter];

你可能感兴趣的:(ios,objective-c,节日)