我想截取我写的视图控制器的屏幕截图:-
- (UIImage *)captureScreenInRectWOScroll:(CGRect)captureFrame {
CALayer *layer;
layer = self.view.layer;
UIGraphicsBeginImageContext(captureFrame.size);
CGContextClipToRect (UIGraphicsGetCurrentContext(),captureFrame);
[layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return screenImage;
}
我调用此方法的方式:-
UIImage *img_woscroll1 =[self captureScreenInRectWOScroll:CGRectMake(35,147,497,260)];
我想从下面的附图中截取地址的屏幕截图:-
当我从上面的代码中截取屏幕截图时,如果图像:-
请帮助我..如何从图像中获取正确的屏幕截图,这样我就不会在顶部看到空白图像。