northwind / flyimage Goto Github PK
View Code? Open in Web Editor NEWDownload, cache, render small images with UIImageView category
Home Page: https://github.com/northwind/FlyImage
License: MIT License
Download, cache, render small images with UIImageView category
Home Page: https://github.com/northwind/FlyImage
License: MIT License
Originally posted by @jinPeng90 in #20 (comment)
作者你好,偶然的机会看到了你的这个开源库,看了一下你的代码,我觉得有几个问题,列出一下,欢迎交流。
FlyImage
库,在Example测试中,SDWebImageTableViewCell
的实现中,对imageView
做得操作如下,设置masksToBounds
为YES
会造成大量的离屏渲染,所以在icon
测试中,会出现更加严重的掉帧。实现圆角功能应该使用你项目中实现的那种方式,使用Core Graphics API
。@implementation SDWebImageTableViewCell
- (id)imageViewWithFrame:(CGRect)frame {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.layer.masksToBounds = YES; //会触发离屏渲染,导致滑动时掉帧严重
imageView.layer.cornerRadius = 10;
[self addSubview:imageView];
return imageView;
}
在进行图片下载时,给Session
的配置为backgroundSessionConfigurationWithIdentifier
,即后台模式,所以在进行下载时,其优先级比较低,也就对性能消耗比defaultSessionConfiguration
要低一些,其下载完成时间会变长。
下载时使用了AFNetworking 的SessionManager
进行下载,所以当不再需要Session
时,需要调用invalidateAndCancel
或finishTasksAndInvalidate
(AFURLSessionManager
提供了封装好的- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks
方法),否则会造成内存泄露,因为Session
会强引用delegate
。Apple Developer Documentation
Important: The session object keeps a strong reference to the delegate until your app explicitly invalidates the session. If you do not invalidate the session, your app leaks memory.
编译提示错误:
FlyImage/src/MoneyKeeper/MoneyKeeper/FlyImage/Core/FlyImageDownloader.m:229:50: Sending 'void (^)(NSProgress * _Nonnull __strong)' to parameter of incompatible type 'NSProgress *__autoreleasing _Nullable * _Nullable'
就比如,我有一个分辨率极高的图,要在pad 上渲染.现在的情况是,内存直接暴增,直接crash. 这个库是否可以完美解决?减少内存的开销?
我是不是可以这么理解.比如,普通加载一张图,需要的是500M ,如果使用这个库的话,内存也就只需要250M.当然,我现在还没进行试验.
Trapped uncaught exception 'NSGenericException', reason:
'*** Collection <__NSArrayM: 0x1708526f0> was mutated while being enumerated.'
(
0x00000001896721d8 + 148
0x00000001880ac55c objc_exception_throw + 56
0x0000000189671c08 + 0
0x000000010029c98c -[FlyImageRetrieveOperation
0x000000010029cb48 -[FlyImageRetrieveOperation main]
)
if (contentType == ImageContentTypeUnknown || contentType == ImageContentTypeGif || contentType == ImageContentTypeTiff)
{
return nil;
}
如题,请大神指导一下。
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x1c4e59620> was mutated while being enumerated.'
*** First throw call stack:
(0x1854f6364 0x18473c528 0x1854f59f0 0x1009a39a8 0x1009a3b64 0x185dfd4c4 0x185ecf894 0x101a4528c 0x101a52678 0x101a50f08 0x101a569d0 0x101a566f4 0x18511b06c 0x18511ab6c)
libc++abi.dylib: terminating with uncaught exception of type NSExceptio
1.FlyImage.podspec 中使用的是FLYIMAGE_WEBP代码中使用的是FlyImage_WebP
2.podfile中使用use_frameworks!
会找不到libwebp/webp/decode.h
#ifdef FLYIMAGE_WEBP
#import "libwebp/webp/decode.h"
#endif
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.