在应用内截取屏幕
- (UIImage *)captureImageFromView:(UIView *)view{
CGRect screeRect = [view bounds];
UIGraphicsBeginImageContext(screeRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[view.layer renderInContext:ctx];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
保存图片在本地相册中
UIImage *image = [self captureImageFromView:self.view];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
网友评论