Description
Description
调用方法
YBIBImageData *ybData = [YBIBImageData new];
ybData.imageURL = [NSURL URLWithString:urlString];
ybData.projectiveView = nil;
YBImageBrowser *browser = [YBImageBrowser new];
browser.dataSourceArray = @[ybData];
browser.currentPage = 0;
[browser show];
崩溃的地方
UIImage *YBIBSnapshotView(UIView *view) {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
建议:
UIImage *YBIBSnapshotView(UIView *view) {
//这里加上
if(![view isKindOfClass:UIView.class] || view.bounds.size.width<=1||view.bounds.size.height<=1){
return UIImage.new;
}
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Environment
- YBImageBrowser version:3.0.9
- iOS version:ios17