当reloadData()
完成但网络没有停止时。
活动指标永远不会停止已在设备上更新的值
这是我的代码
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell? {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! drinkTableViewCell
tableView.allowsSelection = false
cell.parseObject = object
cell.titles.text = object?.objectForKey("title") as? String
cell.praise.text = object?.objectForKey("praise") as? String
cell.prise.text = object?.objectForKey("price") as? String
if let pfObject = object{
var amount:Int! = pfObject["amount"] as! Int
if amount == nil{
amount = 0
}
cell.count.text = String(amount)
if amount <= 0 {
cell.minus.hidden = true
}else{
cell.minus.hidden = false
}
}
let imgFile = object?.objectForKey("img") as? PFFile
cell.images.file = imgFile
cell.images.loadInBackground()
object?.fetchInBackgroundWithBlock({ (object, error) in
self.tableView.reloadData()
})
return cell
}
我试过这个
if object?.dataAvailable == true{
object?.fetchInBackgroundWithBlock({ (object, error) in
self.tableView.reloadData()
})
}