次のコードがあります。
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
UIGraphicsBeginImageContextWithOptions(mainView.bounds.size, NO, [UIScreen mainScreen].scale);
}
else {
UIGraphicsBeginImageContext(mainView.bounds.size);
}
[mainView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *saveImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
mainView には、このメソッドを使用すると saveImage に表示されないマスクされたサブビューがあります。ただし、そのようなアクティビティをキャプチャする iOS 4 より前の UIGetScreenImage メソッドがあったことは理解しています。私の質問は、iOS 6 で CALayer のアクティビティをキャプチャする最良の方法は何ですか? UIGetScreenImage はまだ非公開ですか?