//截屏 过滤掉自定义的window
+(void)createScreenShot:(NSString *)account withPicName:(NSString *)picName WithScale:(CGFloat)scale byFilter:(UIWindow *)window {
//过滤掉小window
[UIView animateWithDuration:0.005 animations:^{
window.alpha=0.0;
} completion:^(BOOL finished) {
[self createScreenShot:account withPicName:picName WithScale:scale WithCompress:0.3];
window.alpha=1.0;
}];
}
//截取小图(自定义路径)
+(void)keepScreenShotWithSmallPicName:(NSString *)name WithImageOfSmallRect:(CGRect)frame fileDir:(NSString *)dir WithScale:(CGFloat)scale
{
UIImage * image=[self getImageWithFullScreenshot:scale];//大图
CGRect rect=frame;
CGImageRef sourceImageRef = [image CGImage];
CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect);
UIImage * newImage = [UIImage imageWithCGImage:newImageRef];//小图
CGImageRelease(newImageRef);
UIGraphicsEndImageContext();
NSData * smallScreenData =UIImagePNGRepresentation(newImage);
//保存起来
[XLHelpClass writeFileContentNsData:[NSString stringWithFormat:@"%@",dir] withName:name withData:smallScreenData];
}
转载于:https://www.jianshu.com/p/3d394efd3e35