ios - Parse - imageView as PFFile won't load -
i don't understand going on. have image saved pffile in parse. can see , know there. want have cell image. rest of code below works fine , memory addresses of pffile print. textlabel , detailtextlabel fine images won't show (even if delete 'loadinbackground'). ideas?
override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath, object: pfobject?) -> pftableviewcell? { var cell = tableview.dequeuereusablecellwithidentifier("cell") as! pftableviewcell! if cell == nil { cell = pftableviewcell(style: .subtitle, reuseidentifier: "cell") } if let name = object?["name"] as? string { cell.textlabel?.text = name } if let artist = object?["artist"] as? string { cell.detailtextlabel?.text = artist } if let artwork = object?["artwork"] as? pffile { println("we've got artwork image \(artwork)") //cell!.imageview!.image = uiimage(named: "placeholder.jpg") cell.imageview?.file = artwork cell.imageview?.loadinbackground() } return cell }
parse saves reference image in table, have async call retrieve message.:
let artwork = object?["artwork"] pffile artwork.getdatainbackgroundwithblock { (imagedata: nsdata?, error: nserror?) -> void in if error == nil { if let imagedata = imagedata { let image = uiimage(data:imagedata) } } }
Comments
Post a Comment