我正在用Swift构建一个补充工具栏。 我得到这个错误在此代码:无法指定'UIColor'类型的值来键入'String?'
override 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")
cell!.backgroundColor = UIColor.clearColor()
cell!.textLabel!.text = UIColor.darkTextColor()
}
// Configure the cell...
return cell
}
所以有确实有人这个平台,有同样的问题上。在解决方案,他们说,我要补充的背后UIColor.darkTextColor()
一个!
,但如果我这样做还有另外一个错误,我不得不删除!
的错误是在该行:
细胞.textLabel!
你们知道发生了什么事吗?
错误信息是什么? –
@JeffPuckettII在标题中? – Hamish