You neet to tell the UIImage
the scale of the :
- (UIImage*) maskImage:(UIImage *)image withMask:(UIImage *)maskImage {
CGImageRef maskRef = maskImage.CGImage;
CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false);
CGImageRef masked = CGImageCreateWithMask([image CGImage], mask);
CGFloat scale = [UIScreen mainScreen].scale;
return [UIImage imageWithCGImage:masked scale:scale orientation:UIImageOrientationDown];
}
You could probably also get the effect with a CAGradientLayer
so that you do not have to make a new image. It will be a bit less CPU intensive.