ios - display thumbnail images from URL’s in tableVeiw Cell -
i want display thumbnail images url’s in every tableview cell. working fine. problem when scroll causes gui delays. know because of url request every time scroll or every time new cell created. there better way it, not cause ui delays.
i'm using following code:
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell: welcomecell = welcomecell(); cell = self.tblviewstudent.dequeuereusablecellwithidentifier("welcomecell") welcomecell if news != nil { if news.count > 0 { var objnews = news(); objnews = news.objectatindex(indexpath.row) news; cell.lblnewssubject.text = objnews.subject; cell.lblnewstime.text = objnews.created_at; cell.lblnewssummery.text = objnews.summery; let url = nsurl(string: objnews.thumbnailurl) let data = nsdata(contentsofurl: url!) cell.viewimagethumbnail.image = uiimage(data: data!); } else { // nothing } } return cell; } thanks in advance.
save thumbnail images url’s in array or mutable array when class first load place image array cell.viewimagethumbnail.image
Comments
Post a Comment