原文鏈接(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.
网友评论