我正在尝试绘制一些图像并使用以下代码。在我的模拟器(iphone 6和6 plus)上,它没有显示任何颜色,它变得透明。但是,在我的iPhone 5设备和iPhone 5模拟器上,它可以显示颜色。我可以知道会发生什么吗?有没有人在iPhone 6和6 plus设备上测试/完成?
CGContextSetFillColorWithColor(context, [[UIColor colorWithRed:0.973 green:0.976 blue:0.976 alpha:1.000] CGColor]);
编辑:更多代码
CGContextRef context;
UIGraphicsBeginImageContext(CGSizeMake( [self width],
[self height]));
context = UIGraphicsGetCurrentContext();
switch (kind) {
case PKNumberPadViewImageLeft:
CGContextTranslateCTM(context, 6.0, [self height]);
break;
case PKNumberPadViewImageInner:
CGContextTranslateCTM(context, 0.0, [self height]);
break;
case PKNumberPadViewImageRight:
CGContextTranslateCTM(context, -6.0, [self height]);
break;
}
CGContextScaleCTM(context, 1.0, -1.0);
CGContextAddPath(context, path);
CGContextClip(context);
//----
CGRect frame = CGPathGetBoundingBox(path);
//TODO: Ios 8 iph 6 and 6 plus not ok
CGContextSetFillColorWithColor(context, [[UIColor colorWithRed:0.973 green:0.976 blue:0.976 alpha:1.000] CGColor]);
CGContextFillRect(context, frame);
CGImageRef imageRef = CGBitmapContextCreateImage(context);
UIImage * image = [UIImage imageWithCGImage:imageRef scale:[[UIScreen mainScreen] scale] orientation:UIImageOrientationDown];
CGImageRelease(imageRef);
UIGraphicsEndImageContext();
CFRelease(path);