我渲染多个层来得到一个最终的图像。其中一个图像包含一个人脸,另一个包含一个背景,该背景在面部周围具有透明的渐变,以便隐藏真正的背景。在iOS6中,它可以完美地工作,但它在iOS7中创建了一个奇怪的透明渐变效果。
代码:
CGRect rect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[faceImageView.layer renderInContext:context];
[fakeBackgroundImageView.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();iOS6和iOS7中的结果:


发布于 2013-09-26 19:46:20
好的,解决方案是更改这一行:
UIGraphicsBeginImageContext(rect.size);对于这一条:
UIGraphicsBeginImageContextWithOptions(rect.size, TRUE, [[UIScreen mainScreen] scale]);现在它也可以在iOS7中工作了
https://stackoverflow.com/questions/19024785
复制相似问题