swift2 - Sticky scroll from cached images in Swift 2 -


i using code display image inside uicollectionview lets cells 25. when go down last cell , try go first images loading again (from cache still shows loading indicator. phone iphone se , dont have many apps , phone running perfect. if load app older iphone many data on scrolling becomes sticky , annoying. how can avoid happening inside collections view function cell item @ index path ???

let cell = collectionview.dequeuereusablecellwithreuseidentifier("recipescell", forindexpath: indexpath) as! recipescell     // cover image         let mycache = imagecache(name: recipesclass.objectid!)         let queue = dispatch_get_global_queue(dispatch_queue_priority_default, 0)         let optioninfo: kingfisheroptionsinfo = [             .downloadpriority(0.5),             .callbackdispatchqueue(queue),             .transition(imagetransition.fade(1)),             .targetcache(mycache)         ]         if  let imagefile = recipesclass[recipes_cover] as? pffile {          let url = nsurl(string: imagefile.url!)!          cell.coverimage.kf_setimagewithurl(url, placeholderimage: nil,             optionsinfo: optioninfo,             progressblock: { receivedsize, totalsize in                 print("\(indexpath.row + 1): \(receivedsize)/\(totalsize)")             },             completionhandler: { image, error, cachetype, imageurl in                 print("\(indexpath.row + 1): finished")                 print("cachetype: \(cachetype) \(indexpath.row + 1): finished")         })          } else {              cell.coverimage.image = uiimage(named:"logo")         } 

does has same issue? thanks!

fyi i'm using parse , kingfisher caching

after days of research ui kit , analyzing app instruments > time profiler figured out image decoding being executed on main thread. bad practise. kingfisher has option decodes images on background , app went lot faster on old iphones still bit sticky. took off rounded corners on cell , enabled paging slow down scroll , great now.

for background image decode used this

   let optioninfo: kingfisheroptionsinfo = [             .downloadpriority(0.5),             .callbackdispatchqueue(queue),             .transition(imagetransition.fade(1)),             .targetcache(mycache),             .backgrounddecode //this new option added         ] 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -