- (UIImage*)getp_w_picpath{//截屏使用的方法
CGSize p_w_picpathSize = [[UIScreen mainScreen] bounds].size;
if (NULL != UIGraphicsBeginImageContextWithOptions) {
UIGraphicsBeginImageContextWithOptions(p_w_picpathSize, NO, 0);
} else {
UIGraphicsBeginImageContext(p_w_picpathSize);
}
CGContextRef context = UIGraphicsGetCurrentContext();
for (UIWindow *window in [[UIApplication siharedApplication] windows]) {
if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) {
CGContextSaveGState(context);
CGContextTranslateCTM(context, [window center].x, [window center].y);
CGContextConcatCTM(context, [window transform]);
CGContextTranslateCTM(context,
-[window bounds].size.width * [[window layer] anchorPoint].x,
-[window bounds].size.height * [[window layer] anchorPoint].y);
[[window layer] renderInContext:context];
CGContextRestoreGState(context);
}
}
UIImage *p_w_picpath = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return p_w_picpath;
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。