我该如何解决这个问题?谢谢 这是一个 tableviewcell 错误,我不明白这个问题。请帮助我。 我有一个像 ITableViewCell 的 Downcast 这样的错误?到 UITableViewCell 只解包选项,你的意思是使用'!'?
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var cell : UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cell") as?UITableViewCell
if(cell == nil)
{
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
}
let film = self.filmler[indexPath.row] as! Dictionary<String, AnyObject>
let filmAdi = film["ad"]! as! String
cell!.textLabel!.text = filmAdi
return cell!;
}
最佳答案
var cell : UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cell")
if cell == nil {
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
}
关于ios - 从 ITableViewCell 失望?到 UITableViewCell 只解包 optionals,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36350412/