【发布时间】:2015-06-14 22:18:30
【问题描述】:
我不明白发生了什么。我在 Parse 中有一个保存为 PFFile 的图像。我可以看到它,我知道它就在那里。我想把它作为一个单元格图像。下面的其余代码工作正常,PFFile 的内存地址也打印出来。 textLabel 和 detailTextLabel 也很好,但图像不会显示(即使我删除了“loadInBackground”)。有什么想法吗?
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 an artwork image \(artwork)")
//cell!.imageView!.image = UIImage(named: "placeholder.jpg")
cell.imageView?.file = artwork
cell.imageView?.loadInBackground()
}
return cell
}
【问题讨论】:
标签: ios swift parse-platform