【发布时间】:2016-01-02 17:41:38
【问题描述】:
谁能告诉我我的代码有什么问题我总是在所有单元格中重复相同的数据
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
cell.textLabel!.textColor = UIColor.whiteColor()
let query = PFQuery(className:"book")
query.findObjectsInBackgroundWithBlock {
(objects: [PFObject]?, error: NSError?) -> Void in
var contentString:String = String()
if error == nil {
print("Success retrieved \(objects!.count) scores.")
if let objects = objects {
for object in objects {
let a:String = object.objectForKey("title") as! String
contentString = a
}
}
cell.textLabel!.text = contentString
}}
return cell
}
【问题讨论】:
-
这类似于 stackoverflow.com/questions/34524180/…> 使用 tableview 单元格 id 应该是唯一的
标签: swift uitableview parse-platform