I have a tableview with several times, so the user could confirm that I consumed the medicine in one of the schedules in question, so I just needed to update the tableview after user confirmation and remove that time from the list , I tried the following but not successful. Anyone know me explaining why this is not updating and a way to be able to update this data
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
if indexPath.section == 1{
let confirmar = UITableViewRowAction(style: .Normal, title: "Já Tomei") { action, index in
self.confirmaTomouDoseMedicamento((self.arrayNotificacoesAtrasadas[indexPath.row].id))
self.arrayNotificacoesAtrasadas.removeAtIndex(indexPath.row)
self.tableView.reloadData()
}
confirmar.backgroundColor = UIColor.blueColor()
return [confirmar]
}
return nil
}
func confirmaTomouDoseMedicamento(idNotificacao: Int){
let appDel: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let contexto: NSManagedObjectContext = appDel.managedObjectContext
NotificacaoDAO().confirmaDosagem(contexto, idNotificacao: idNotificacao)
}