문제

I'm downloading and saving some images from the web into my app's private storage to be displayed in tableview cells. I have it working, but unfortunately unless I'm using :

[UIImage imageNamed: @"filename"]; 

I don't get the built-in cache, and performance is slow. How can I implement my own image cache when using imageWithData or imageWithContentsOfFile?

도움이 되었습니까?

해결책

I've seen more then a few discussions of this online over the years with various solutions and rationales. Arguably the simplest solution is here.

In short with large numbers of images, UIImage imageNamed is rough on memory and it suggests using a simple dictionary with imageWithContentsOfFile to store cached images where you can easily have more control over memory usage.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top