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
}
I want to print the article number on the table row. I have tried this code but it's not working. In addition, the term searchResult
contains objects array of array.
Update your code this way:
var user = self.searchResult[indexPath.row] as! PFObject
println(user)
cell.textLabel?.text = user.objectForKey("Article_Number") as! String
return cell