ios - Access variable from UITableViewCell in the TableViewController for specific cells? -


i new coding ios. have tableviewcell has boolean in (to check if button has been pressed).

class chintwotableviewcell: uitableviewcell {  @iboutlet var countlabel: uilabel! @iboutlet var namelabel: uilabel! @iboutlet var bodytext: uitextview!  var likecheck:bool = false  // other code  @ibaction func liketapped(sender: anyobject) {     if((likecheck) == false) {         sender.settitlecolor(uicolor.redcolor(), forstate: uicontrolstate.normal)         likecheck = true     } else {         sender.settitlecolor(uicolor.whitecolor(), forstate: uicontrolstate.normal)         likecheck = false     } }     

}

i access boolean in tableviewcontroller, , check if true, stuff, if false, stuff.

how can check pertains correct row in other class?

rather creating bool directly in uitableviewcell suggest create model class.

the view controller keep array of model classes it. in cellforrow callback controller can pass model class cell , cell can modify if required.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -