lazyload images on the iphone

▼魔方 西西 提交于 2019-12-08 07:02:19

问题


Does anyone know of a good tutorial that shows how to lazy load images in a UITableView? I've searched online but the only one I found that looked like it did what I wanted was hard to follow because only parts of the code were shown and I'm new at this so I didn't understand how to hook everything up.


回答1:


I suggest you check out the SDWebImage project on github, I use it for my table views when I need to load a remote image into the cells.

https://github.com/rs/SDWebImage




回答2:


As Daniel suggested SDWebImage https://github.com/rs/SDWebImage, I don't know of any tutorial, but in amongst the KTPhotoBrowser samples there is one that uses SDWebImage that can show you how to do it https://github.com/kirbyt/KTPhotoBrowser/tree/master/src/Sample/Classes/SDWebImageSample

If I remember correctly you need to import and use the SDWebImage UIImageView category and then pass the url to the cell and call

setImageWithURL:[NSURL URLWithString:@"yoururl"] placeholderImage:[UIImage imageNamed:@"placeholder.png"] 

when setting the cell image.




回答3:


I haven't actually followed it, but this one has plenty of positive commentary: http://www.markj.net/iphone-asynchronous-table-image/



来源:https://stackoverflow.com/questions/7060113/lazyload-images-on-the-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!