0
 UIGraphicsBeginImageContext(self.bounds.size );
 [self.layer renderInContext:UIGraphicsGetCurrentContext()];
 UIImage *currentScreen = UIGraphicsGetImageFromCurrentImageContext();
 UIGraphicsEndImageContext();

这里我无法获取更新暂存器的屏幕截图,但它没有显示在我的屏幕截图中![暂存器屏幕截图][1]

4

1 回答 1

0

如果您考虑截取UIView or UIImageView.

 UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, 1.0);// Add your view / ScratchPadView whichever you want to take Snap
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    [[UIColor redColor] set];
    NSData *imgData =  UIImageJPEGRepresentation(image, 1.0);
    UIGraphicsEndImageContext();
于 2013-10-25T12:10:39.253 回答