Ios 如果满足条件,有没有办法从PFQuery中删除行?
如果从Ios 如果满足条件,有没有办法从PFQuery中删除行?,ios,uitableview,swift,parse-platform,pfquerytableviewcontrolle,Ios,Uitableview,Swift,Parse Platform,Pfquerytableviewcontrolle,如果从var cellStatus=object[“active”]检索到的条件为,我将尝试删除一行!Bool为false。我尝试了两种不同的方法,但似乎都无法奏效。隐藏单元格只会在tableView中留下很大的间隙 class TableViewController: PFQueryTableViewController { override init(style: UITableViewStyle, className: String!) { super.init(
var cellStatus=object[“active”]检索到的条件为,我将尝试删除一行!Bool
为false
。我尝试了两种不同的方法,但似乎都无法奏效。隐藏单元格只会在tableView中留下很大的间隙
class TableViewController: PFQueryTableViewController {
override init(style: UITableViewStyle, className: String!) {
super.init(style: style, className: className)
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.parseClassName = "specials"
self.pullToRefreshEnabled = true
}
// Define the query that will provide the data for the table view
override func queryForTable() -> PFQuery {
var query = PFQuery(className: parseClassName!)
query.limit = 6
query.orderByAscending("specialRank")
return query
}
//override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject!) -> PFTableViewCell {
var cellStatus = object["active"] as! Bool
var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! PFTableViewCell!
if cell == nil {
cell = PFTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
}
if let locationName = object["locName"] as? String {
cell?.textLabel?.text = locationName
}
if let spec = object["special"] as? String {
cell?.detailTextLabel?.text = spec
}
return cell
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
var detailScene = segue.destinationViewController as! DrinkInfoViewController
// Pass the selected object to the destination view controller.
if let indexPath = self.tableView.indexPathForSelectedRow() {
let row = Int(indexPath.row)
detailScene.currentObject = objects?[row] as? PFObject!
}
}
override func viewWillAppear(animated: Bool)
{
self.navigationController?.navigationBarHidden = false
}
}
不要使用查询表视图控制器…包括
wherekey
检查您的查询?使用wherekey工作正常。我不知道我怎么会忽视这一点。谢谢