我正在尝试使用FirebaseUI在UITableViewController
中显示数据。一切似乎都有效,但它显示数据名称而不是值。我的代码如下。怎么可以改变呢?
import UIKit
import Firebase
import FirebaseUI
class TableViewController: UITableViewController {
var firebaseRef = Firebase(url:"https://the-lighthouse-app.firebaseio.com/states")
var dataSource: FirebaseTableViewDataSource!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.dataSource = FirebaseTableViewDataSource(ref: self.firebaseRef, cellReuseIdentifier: "Cell1", view: self.tableView)
self.dataSource.populateCellWithBlock { (cell: UITableViewCell, obj: NSObject) -> Void in
let snap = obj as! FDataSnapshot
// Populate cell as you see fit, like as below
cell.textLabel?.text = snap.key as String
}
self.tableView.dataSource = self.dataSource
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}