ios - 无法使用 PFQuery Table ViewController (Swift 2) 显示自定义单元格

标签 ios parse-platform swift2 parseui pftableviewcell

使用 parse.com v1.4(与 cocoa pod 一起安装)和 Swift 2 +

我已经使用自定义单元格设置了我的 PFQueryTableViewController (ParseUI)。我相信一切都很好,但是我无法让单元格显示来自 Parse.com 的值,即使我确实收到了它并且可以打印它(我已经调试过了)。

我像这样出队:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell {

    let cellIdentifier = "Cell"

    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! OrderTableViewCell

    // Extract values from the PFObject to display in the table cell
    if let pfObject = object {

        // prints expected value, e.g. 1, 2, 3
        print(pfObject["table"])

        // shows "Label" which is my label's default text on the SB!!
        let table = pfObject["table"] as? String
        cell.lblTable.text = table
    }
    return cell
}

我的 PFQueryTableViewController 的其余部分似乎可以从 Parse 加载数据:
enter image description here

我的自定义单元格 OrderTableViewCell(带有一些标签 IBActions):
enter image description here

SB设置:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

结果:

enter image description here

如何让标签显示实际文本?我错过了什么?由于我通过 Parse UI 获得的附加功能,我不想恢复到标准 UITableView。

最佳答案

原来它就像改变一样简单

let table = pfObject["table"] as? String


let table = String(pfObject["table"])

关于ios - 无法使用 PFQuery Table ViewController (Swift 2) 显示自定义单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34986817/

相关文章:

ios - 有没有办法查看构建中包含的 UDID?

android - UIBezierPath 到 NSData 到服务器到 Android

ios - 在 swift 2.0 中允许用户播放背景音乐

ios - 核心数据 - NSManagedObject 返回 nil

当手机处于 sleep 模式时,iOS BLE 在后台扫描广告数据

ios - 在 Tableview 标题中找到 UIButton 并更改按钮标题

ios - 解析 iOS Swift 中的 SaveEventually 问题

ios - 快速的 Alamofire POST 请求

ios - UISearchController 搜索栏在显示时向下移动

swift - 如何在 Swift 中比较指针解析对象?