ios - Sending data from IBAction in TableViewCell to TableViewViewController -


i have tableview it's own class , class tableviewcell. in tableview class have array want fill added users, added pressing add button in corresponding tableviewcell, way i've solved using button.tag = indexppath.row , i've set array global array, isn't optimal.

so question is, inside ibaction follow button, how can pass data tableviewclass without having perform segue?

note: it's in swift

i define "adduserdelegate" protocol, regadless whether swift or objective-c, tableviewcontroller implmeents/conforms to.

then add (weak) reference tableviewcontroller - or protocol respectively - tablecellview class , call protocol's delegate method accordingly within action of button. additional data required button's action has hand protocol's method in order identify cell hast been pressed or object refers etc. add instance variable (weak again if reference) custom tableview class (you have 1 already) , pass them though. create own class anyway there no reason more abuse view's tag property business logic (for is not intended).


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -