0
I am with a tableview with several times, so the user could confirm that consumed the medicine at one of the times in question, until then it is okay, only that I needed to update the tableview after confirmation of the user and remove this time from the list, I tried it this way but without success. Does anyone know how to explain to me why 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)
}
Try to put the self.tableView.reloadData() out of the if.
– JdsMedeirosBR