Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #206 #208 #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions XHLaunchAd/XHLaunchAd/XHLaunchImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ -(UIImage*)imageFromView:(UIView*)view{
CGSize size = view.bounds.size;
//参数1:表示区域大小 参数2:如果需要显示半透明效果,需要传NO,否则传YES 参数3:屏幕密度
UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);
if ([view respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
}else{
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
}
/**
基于以下Issues反馈暂不使用drawViewHierarchyInRect:afterScreenUpdates:方法截图
1、如果直接在AppDelgate里直接初始化XHLaunchAd,该方法截图失败返回NO(https://github.com/CoderZhuXH/XHLaunchAd/issues/206);
2、有人反馈在iOS 11.4真机crash(https://github.com/CoderZhuXH/XHLaunchAd/issues/208)。
*/
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
Expand Down