ios - Swift if statement in CellForRowAtIndexPath -
i have tableview
want display different cells depending on variable segueddisplaymonth
set to. possible , if can hint on how this? i've tried following doesn't seem work.
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("income cell", forindexpath: indexpath) let income = myincomearray[indexpath.row] if segueddisplaymonth == "all" { var text = "\(income.money) kr" cell.textlabel?.text = text cell.detailtextlabel?.text = income.name } return cell }
i thought maybe need reload data after changing segueddisplaymonth
gets changed different tableview
, through segue
.
call mctableswag.reloaddata()
once segueddisplaymonth
changed. (likely call in function changes segueddisplaymonth
.
alternatively reload certian cells method reloadvisiblecellsatindexpath(...)
(im not sure called exactly, should on apple uitableview documentation.
Comments
Post a Comment