2015-08-13 56 views
0

我無法加載圖像的默認PFCollectionViewCell。我使用的是PFQueryCollectionViewController,並且已經正確設置了這些東西 - imageFile除外。抓取PFFile並加載默認PFCollectionViewCell

默認PFCollectionViewCell有兩個字段:PFImageViewUILabel

override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFCollectionViewCell? { 
    var cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as? PFCollectionViewCell 
    if cell == nil { 
    cell = PFCollectionViewCell() 
    } 
    let nom = object as! Nom 
    cell?.imageView.file = nom.imageFile 
    println(nom.imageFile) //prints the object id 
    cell?.imageView.loadInBackground() //nothing actually loads 

    cell?.textLabel.text = nom.createdBy.name //textlabel is populated properly 
    return cell 
} 
  1. 我能夠填充文本框
  2. 我無法填充的ImageView

我在做什麼錯?

回答

0

想通了:你需要確保你也加載佔位符圖像。您必須設置PFImageViewimage屬性。

他們應該真的記錄下...