ios - Updating a Table View From a Different File - Cannot invoke 'reloadData' with no arguments -
i trying refresh table view different file. i've been trying use .reloaddata()
, doesn't seem working.
here code...
@ibaction func addbuttonpressed(sender: anyobject) { // alert func showaddalert() { print("show add alert user") //create new alert let addalert = uialertcontroller(title: "add company", message: addalertmessage, preferredstyle: uialertcontrollerstyle.alert) //create actions alert let yesalert = uialertaction(title: "yes", style: uialertactionstyle.default, handler: { (action: uialertaction!) in portfolio1.append(self.newcompany) print("user added company") print(portfolio1) stocktableviewcontroller.tableview.reloaddata() // cannot invoke 'reloaddata' no arguments }) let noalert = uialertaction(title: "cancel", style: uialertactionstyle.cancel, handler: { (action: uialertaction!) in print("user canceled action") self.counter++ }) //add actions alert addalert.addaction(noalert) addalert.addaction(yesalert) //present user self.presentviewcontroller(addalert, animated: true, completion: nil) } // present alert showaddalert() }
and here files...
appdelegate.swift stocktableviewcontroller.swift graphviewcontrollerviewcontroller.swift // - (where code from) main.storyboard
thanks.
what should instead implement local notifcations or kvo tableview
knows when needs reloaded, , reload within proper file according when notification received.
Comments
Post a Comment