2015-03-19 54 views
0

我正在使用UITableView,並且遇到了文本屬性的一些問題。我已經正確地宣佈了一切,我確定一切都是正確的。這裏是我的代碼錯誤:Swift不接受文本屬性?

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ 
    let cell : UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "Test") 
    cell.text = taskAdder.tasks[indexPath.row].name 
    return cell 
} 

的錯誤就行了:

cell.text = taskAdder.tasks[indexPath.row].name

它說:

'text' is unavailable: APIs depreciated as of iOS 7 and earlier are unavailable in Swift. 

我不確定這是什麼錯誤意味着或如何解決它。

任何輸入和建議將不勝感激。

在此先感謝。因爲iOS的7 使用cell.textLabel.text

回答

1

錯誤說沒有文字上的方法 「的UITableViewCell」

你有沒有嘗試「cell.textLabel」,因爲textLabel,detailTextLabel用於設置UITableViewCell中的文本

+0

沒關係。謝謝。這工作。 – Bigfoot11 2015-03-19 10:32:22