抓取PFFile并加载默认PFCollectionViewCell

时间:2015-08-13 10:57:17

标签: parse-platform

我在使用默认PFCollectionViewCell加载图片时遇到问题。我正在使用PFQueryCollectionViewController,并正确设置了这些内容 - 除了imageFile。

默认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. 我能够填充textField
  2. 我无法填充imageView
  3. 我做错了什么?

1 个答案:

答案 0 :(得分:0)

想出来:你需要确保你还要加载占位符图像。您必须设置image的{​​{1}}属性。

他们应该真的记录下来......