Reload data tableview in swift -
when run tableview.reloaddata()
in uitableviewcontroller, works, when call function update tableview controller not work.
//this way works normally
func reloadtableview() {
let path = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true ).first string let db = database("\(path)/db.sqlite"); conversasarray.removeall(keepcapacity: true); let stmt = db.prepare("select znome,zultimamsg,zidmensagem,zimage zusuario,zchat ztelefone = zto") var objetoconversa : anyobject = []; row in stmt { objetoconversa = ["znome":"\(row[0]!)", "zultimamsg":"\(row[1]!)", "zidmensagem":"\(row[2]!)", "zimage":"\(row[3]!)"]; //adiciona o objeto dentro array de objetos. conversasarray.append(objetoconversa) } tableview.reloaddata();
}
//but when file tableview.reloaddata() not work.
var = tableviewcontroller();
a.reloadtableview();
Comments
Post a Comment