TableView does not update

0

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)
}
    
asked by anonymous 01.11.2016 / 15:41

2 answers

0

Hello, I do not know if it was already able to solve, to update the table view use the reloadData () method.

For example:

self.minhatableView.reloadData()
    
29.11.2016 / 04:51
0

Replace .Normal with .Destructive no style:

let delete = UITableViewRowAction(style: .Destructive, title: "Delete") { (action, indexPath) in
    self.confirmaTomouDoseMedicamento((self.arrayNotificacoesAtrasadas[indexPath.row].id))
    self.arrayNotificacoesAtrasadas.removeAtIndex(indexPath.row)
    self.tableView.reloadData()
}
    
20.12.2016 / 13:15