uitableview - What's the Best way for Lazy loading images in iPhone? -
i want know, best way lazy loading. me, of applications have used parsing , url server , put image table view. have implemented lazy loading improving performance of application. want know best method lazy loading images. because have used lazy loading 4 ways,
lazy loading images apple developer.com
implemented asynchronous method improving lazy loading
used separate main thread handling image downloaded.
have used ecoimageloadingdemo application lazy loading.
but have used above 4 methods achieve lazy loading. want know what's best method lazy loading. 1 best performance wise , memory wise suitable that?
thanks in advance.
regards,
pugal
from experience, performance-wise , memory-wise solutions on opposite ends of slider. can move around solution somewhere between these two, disadvantage having best solution performance-wise, means worse solution memory-wise , vice-versa. hope explained clear enough :)
here's how handle problem of lazy loading images:
in application created 1 entity called globalimageprovider. requests images go through entity. way have control on how many threads use download , can implement caching system (memory + local disk), of these transparent application , full control. controlling size of cache, can control how quick application feels. performance wise, nothing compares having uiimage
created in memory. memory-wise, can choose disable cache.
even more, can change number of threads dynamically while application running depending on quality of network have.
to make online requests, i'm using nsurlconnection
plan on switching else since i've read leaks memory.
on view&controllers side, have asyncimageview
uiimageview
knows how work globalimageprovider
. knows display activity indicator while loading , can handle response globalimageprovider
.
if know url of image want, need add asyncimageview
screen , make request globalimageprovider
asyncimageview
"handler" image.
if don't mixing data image views, can add viewcontroller between globalimageprovider , asyncimageview. gets image response , puts in imageview.
that's it, hope helps bit.
Comments
Post a Comment