1
我試圖顯示每個PFTableViewCell基於imageView屬性不起作用的圖標。我正在使用的代碼是在其下面引發跟隨錯誤,「致命錯誤:意外地發現零,而解包可選值」。無法設置PFTableViewCell imageView?
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject) -> PFTableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! i!
if cell == nil {
cell = PFTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
}
cell.textLabel?.text = "Some Label"
cell.detailTextLabel?.text = "Another label"
cell.imageView.image = UIImage(named: "icon.png")
return cell
}
哪條線導致崩潰? –
cell.imageView.image = UIImage(named:「icon.png」)導致崩潰。 –
「icon.png」是本地文件,還是存儲在Parse.com數據庫中? –