2

我有一个viewA由子视图网格组成的视图 ( )。我正在将viewA的图层渲染到图像上下文并查看子视图之间的线条。这些行在屏幕截图中不存在,就在我将视图渲染到图像上下文时。

这是一个截图viewA<code>viewA</code> 的屏幕截图

这是从以下位置渲染的图像viewA从 <code>viewA</code> 渲染的图像

我正在使用以下代码呈现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];
}
4

0 回答 0