Loading local images from documents directory to tableview using SDWebImage
I am using a tableview which loads images from the documents directory, creates a thumbnail and shows it in the tableview. However, I have a problem: it becomes slow and crashes as the pictures are large, taken using the camera. I have explored several solution including GCD to do the work in a background thread but the result is the same thing. So, I thought to look into SDWebImage but I don't know if it will also work for local files, not web images in this case. Can someone advise me please? If not, how is this problem solved? Is there an API that can help to resolve this issue? | ||
add comment |
0 | That question is not easy to answer as the Question is asked fairly broad but I will do my best. First, I usually dispatch a Background Thread if I have expensive processing to do as to not block the Main Thread, which is fairly important. I don't really know why you are not using the normal UIImageView for what you are doing but try to implement following : And now add the function : If you got a lot of Pictures to load you are well advised to queue your Processes so you don;t "steal" all resources with Grand Central Dispatch. Have a read through this excellent posthttp://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial for further details. Hope that helped |
No comments:
Post a Comment