문제

I have manually created a CGBitmapContext:

bitmapContext = CGBitmapContextCreate( myImageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big );

And drawing a layer to it:

[self.myView.layer renderInContext:bitmapContext];

However, on Retina my layer renders only at half the original size.

Setting the contentScaleFactor property on the UIView doesn't change anything.

What's the right way to do this?

도움이 되었습니까?

해결책

Of course the answer came to me the minute I asked the question. Simply do this:

float scale = self.myView.contentScaleFactor;

CGContextScaleCTM(context, scale, scale);

[self.myView.layer renderInContext:context];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top