我在使用默认PFCollectionViewCell
加载图片时遇到问题。我正在使用PFQueryCollectionViewController
,并正确设置了这些内容 - 除了imageFile。
默认PFCollectionViewCell
有两个字段:PFImageView
和UILabel
。
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
}
我做错了什么?
答案 0 :(得分:0)
想出来:你需要确保你还要加载占位符图像。您必须设置image
的{{1}}属性。
他们应该真的记录下来......