7
私はUIViewのスクリーンショットを撮ってPDFを作成していますが、これは現在網膜ディスプレイを備えたiPad3でうまくいきますが、解像度の低い画面で他のデバイスでテストすると、テキスト解決の問題網膜と非網膜デバイスのレンダリングコンテキスト
は、ここに私のコードです:
//start a new page with default size and info
//this can be changed later to include extra info.
UIGraphicsBeginPDFPage();
//render the view's layer into an image context
//the last option specifies scale. If 0, it uses the devices scale.
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 2.0);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//render the screenshot into the pdf page CGContext
[screenShot drawInRect:view.bounds];
//close the pdf context (saves the pdf to the NSData object)
UIGraphicsEndPDFContext();
は私も2.0にUIGraphicsBeginImageContextWithOptions
規模を設定しようとしたが、これは何の変化も与えません。 iPad2のビューを強制的に2倍の解像度でレンダリングするにはどうすればよいですか?
予想される出力:
実際の出力:
あなたはどんな問題を抱えていますか? 'UIGraphicsBeginImageContextWithOptions'のスケールを2に設定すると、強制的に2倍の解像度でレンダリングする必要があります。正しい画像と誤った画像を表示します。 –
私の質問が更新されました – danielbeard
PDFのスクリーンショットはありますか? 2つの画像は異なるサイズであるが、一方は他方の画像の2倍ではない。もう一方の解像度の2倍の解像度でレンダリングされたようなものもありません。実際の各UIImageをファイルに保存してみてください。 '[UIImagePNGRepresentation(screenShot)writeToFile:@"/tmp/image.png "アトミック:NO]'。シミュレータ上でそれを行い、実行ごとに '/ tmp'からイメージをコピーします。 –