Skip to main content
 首页 » 操作系统

ios之一个简单的iOS应用,尝试学习Swift

2024年01月01日48三少

<分区>

我正在做一个简单的iOS应用,想学习Swift,但是简单的报了一个错误码,不知道怎么解决,如果有人告诉我将不胜感激。

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ 
 
    let cell: UITableViewCell  = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "test") 
    // swift:34:24: Cannot assign to 'textLabel' in 'cell' this error is here 
    cell.textLabel = taskMgr.tasks[indexPath.row].name 
 
    //'UILabel?' does not have a member named 'text' this error is here 
    cell.detailTextLabel.text = taskMgr.tasks[indexPath.row].desk 
 
    return cell 
 
}