由於@Patrick Tescher的答案,這個工程:
- (void) changeToHue:(float)hue saturation:(float)saturation {
UIGraphicsBeginImageContext(self.bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
UIView *hueBlend = [[UIView alloc] initWithFrame:self.bounds];
hueBlend.backgroundColor = [UIColor colorWithHue:hue saturation:saturation brightness:1 alpha:1];
CGContextDrawImage(context, self.bounds, self.image.CGImage);
CGContextSetBlendMode(context, kCGBlendModeHue);
[hueBlend.layer renderInContext:context];
self.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
謝謝,我要再下面你的答案。 –