我有一个viewA
由子视图网格组成的视图 ( )。我正在将viewA
的图层渲染到图像上下文并查看子视图之间的线条。这些行在屏幕截图中不存在,就在我将视图渲染到图像上下文时。
这是一个截图viewA
:
这是从以下位置渲染的图像viewA
:
我正在使用以下代码呈现viewA
到图像上下文:
- (void)saveToPhotoAlbum:(id)sender
{
CGRect frame = self.view.bounds;
UIGraphicsBeginImageContextWithOptions(frame.size, YES, [UIScreen mainScreen].scale);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:context];
UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIActivityViewController* avc = [[UIActivityViewController alloc] initWithActivityItems:[NSArray arrayWithObject:image] applicationActivities:nil];
if ([[self class] iPad]) {
if (popoverController) {
[popoverController release], popoverController = nil;
}
popoverController = [[UIPopoverController alloc] initWithContentViewController:avc];
[popoverController presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[self presentViewController:avc animated:YES completion:^{
}];
}
[avc release];
}