ios - Parse file images not loading to PFTableViewCell -


@iboutlet weak var itemimage: pfimageview!  override func tableview(tableview: (uitableview), cellforrowatindexpath indexpath: (nsindexpath!), object: pfobject!) -> pftableviewcell? {      var cell = tableview.dequeuereusablecellwithidentifier("pftableviewcell") as! itemviewcell!      let items = object as! items      let thumbnail = items.valueforkey("itemimage") as! pffile!     cell.itemimage?.file = thumbnail      return cell } 

when run this, pftableviewcontroller loads infinitely.

commenting out:

cell.itemimage?.file = thumbnail

will load tvc there no images loaded. made every connection/outlet necessary function, in storyboard.

the answer given throw error if trying show image in uiimageview within cell in tableview since have assigned instance of uiimage.

to fix this, need assign uiimageview outlet .image shown below in line;

cell.itemimage.image = image 

full solution works in test project below;

if let pic = items.objectforkey("itemimage") as? pffile {    pic.getdatainbackgroundwithblock(    { (data: nsdata?, error: nserror?) -> void in         if((error) == nil && data != nil)        {            if let image = uiimage(data: data!)             {                 cell.itemimage.image = image             }        }                             else { nslog("error loading profile image in cell") }        } }) 

edit: mentioned in comments of previous post need reload tableview before data display tableview loads before image in example.

you can adding;

tableview.reloaddata() 

at end of function


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -