如何从 PFObject 获取字符串并将其显示到 tableView 单元格中?

How to get String from PFObject and display it into tableView cell?

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
    let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier:"addCategoryCell")

    var user = self.searchResult[indexPath.row] as? [PFObject]
     println(user)
    cell.textLabel?.text = user["Article_Number"] as? String // error here
    return cell
}

我想在 table 行打印文章编号。我试过这段代码,但它不起作用。此外,术语 searchResult 包含数组的对象数组。

以这种方式更新您的代码:

var user = self.searchResult[indexPath.row] as! PFObject
println(user)
cell.textLabel?.text = user.objectForKey("Article_Number") as! String
return cell