美文网首页
iOS UIImage Cache

iOS UIImage Cache

作者: VervertomJC | 来源:发表于2021-01-06 14:27 被阅读0次

原文鏈接(https://medium.com/@maximbilan/ios-uiimage-cache-92563c3ae3c2)

官方(https://developer.apple.com/documentation/uikit/uiimage#//apple_ref/doc/uid/TP40006890-CH3-SW10)

+ (UIImage *)imageNamed:(NSString *)name

This method looks in the system caches for an image object with the specified name and returns that object if it exists. If a matching image object is not already in the cache, this method loads the image data from the specified file, caches it, and then returns the resulting object.

+ (UIImage *)imageWithContentsOfFile:(NSString *)path

This method does not cache the image object.

In the first case the is no way to clear the cache, and if you use different image files with the same name, you will catch a bug in your application, don’t forget about this cache.

相关文章

网友评论

      本文标题:iOS UIImage Cache

      本文链接:https://www.haomeiwen.com/subject/nbbnoktx.html