Comments (2)
建议把这个方法改成下面这样
UIImage *YBIBSnapshotView(UIView *view) {
if (@available(iOS 10.0, *)) {
UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
format.scale = [UIScreen mainScreen].scale;
format.opaque = YES;
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:view.bounds.size format:format];
UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull context) {
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
}];
return image;
} else {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
}
from ybimagebrowser.
有用
建议把这个方法改成下面这样
UIImage *YBIBSnapshotView(UIView *view) { if (@available(iOS 10.0, *)) { UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init]; format.scale = [UIScreen mainScreen].scale; format.opaque = YES; UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:view.bounds.size format:format]; UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull context) { [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO]; }]; return image; } else { UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale); [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } }
👍
from ybimagebrowser.
Related Issues (20)
- 图片未加载完成下拉消失和视频下拉消失的时候,动画位置对不上
- webp格式的图 加载不出来 HOT 1
- 预览视频,下拉消失的时候,从手机屏幕边界回弹
- YBIBImageData.imageURL = [NSURL URLWithString:@"https://www.baidu.com/"]; 会崩溃
- 大神,大家需要你,出来维护吧
- 图片未加载完、视频等,下拉跳闪的解决办法
- 最新SDK,好像没有找到水印的功能
- 播放视频没声音
- 预览时,查看图片黑屏 HOT 3
- ios16上预览视频播放时左右滑动查看相邻的图片,再返回该视频后黑屏。iOS15没问题。 HOT 1
- Image对特大分辨率的渲染支持不太好。极容易因内存问题而crash。 HOT 1
- 什么时候支持 spm 呀? 本来想用 yb, 奈何不支持 spm
- 升级 sdwebimage 5.0 之后 找不到属性 YBImageBrowser shouldDecompressImages
- WEBP图片加载失败 HOT 3
- 崩溃
- 崩溃 HOT 5
- Xcode 15 iOS17 Crash HOT 3
- iOS 14 上的图片打开黑屏什么时候可以更新下 HOT 3
- Can add apple privateInfo?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ybimagebrowser.