function - Swift 不接受文本属性?

标签 function uitableview swift text return

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

相关文章:

c - 如何在输入数组中打印出每个字符的地址和内容

c - 在 C 中使用数组的垃圾值

具有默认非必需值的 Javascript 函数

iOS:如何从 DetailView 导航到 DetailView?

c++ - 无法计算字符类型的数量

ios - UITableViewCell 中的文本换行不正确

uitableview - 如何在没有原型(prototype)单元格的情况下创建表格 View

xcode - 在 Swift 中将字符串转换为 double 值 (Xcode v 7.0.1)

swift - 理解 Swift 中的单例

swift - Object != nil 在 Beta 5 中有效但在 Beta 6 中无效?