我正在用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