我是新來的swift,我需要幫助閱讀下面的代碼。如何在函數調用後讀取代碼塊?
- 什麼是代碼塊的函數調用「self.table.update(completedItem)」 {...}
後的含義是什麼(結果,錯誤)的含義爲代碼塊的第一行:
self.table .update(completedItem){在 // (結果,錯誤)...來代碼 }
全碼:
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
{
let record = self.records[indexPath.row]
let completedItem = record.mutableCopy() as NSMutableDictionary
completedItem["complete"] = true
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
self.table!.update(completedItem) {
(result, error) in
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
if error != nil {
println("Error: " + error.description)
return
}
self.records.removeAtIndex(indexPath.row)
self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
}
}