ios - Rendering the view on uitableviewcell when viewcontroller is shown again -
here cellforrowatindexpath method:
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let documentpartcell = tableview.dequeuereusablecellwithidentifier("documentpartcell", forindexpath: indexpath) as! documentpartcell documentpartcell.documentpart = documentpart return documentpartcell }
and here cell class:
class documentpartcell: uitableviewcell { @iboutlet weak var documentpartprogress: uilabel! var allfields: int var invalidfields: int var documentpart: documentpart? { didset { self.documentpartprogress.text = "\(int(allfields)! - int(invalidfields)!) / \(allfields)" }
basically, documentpartprogress
label shows progress of document. flow of app there cell shows progress in vc1. when cell pressed, moves vc2 , can make changes. when answer questions progress changes. when press back
button in vc2, goes vc1 , should update documentpartprogress
. doesn't. how can update view on uitableviewcell when button in vc2 pressed?
ex) expectation: before changes -> 3/5. after changes -> 4/5
reality: before changes -> 3/5. after changes -> 3/5
the progress label text not change.
just need put yourtableview.reloaddata()
in viewwillappear()
instead of viewdidload()
note, suppose updated datasource array. if didn't update datasource, need update using delegate or posting notification.
let me know if case, update answer more details.
Comments
Post a Comment