我正在使用 UITableView,但文本属性存在一些问题。我已经正确地声明了一切,并且我确信一切都是正确的。这是我的代码,有错误:
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.
我不确定此错误意味着什么或如何修复它。
任何意见和建议将不胜感激。
提前致谢。
最佳答案
错误表明“UITableViewCell”上没有文本方法
您是否尝试过“cell.textLabel”,因为textLabel、detailTextLabel用于在UITableViewCell中设置文本
关于function - Swift 不接受文本属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29141894/