我想要计算在PFQueryTableViewController
中找到的对象的数量。在PFTableQueryViewController中计算找到的对象
我曾试图努力与周围
override func queryForTable() -> PFQuery {
let query = PFQuery(className: self.parseClassName!)
query.whereKey("member", equalTo: memberId!)
let count = query.countObjectsInBackground()
label.text = "\(count)"
return query
}
但我的应用程序会崩溃。
编辑: 问题是不做一个查询并计算它的对象。问题是使用queryForTable
通过我查询到的cellForRowAtIndexPath
我PFQueryTableViewController
的cellForRowAtIndexPath
看起来是这样的:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell? {
let cell:DetailApplicantCell = self.table.dequeueReusableCellWithIdentifier("reuseIdentifier") as! DetailApplicantCell
if let name = object?.objectForKey(self.textKey!) as? String{
cell.nameLbl.text = name
}
cell.groupImage.image = UIImage(named: "People.png")
if let imageFile = object?.objectForKey(self.imageKey!) as? PFFile{
cell.groupImage.file = imageFile
cell.groupImage.loadInBackground()
}
return cell
}
请注意,这不是默认cellForRow
它在哪里崩溃,什么是崩溃日志? – Santosh