swift - How to to hide switch from cell? -


how hide switch cell when barbutton title edit change done how possible?

override func setediting(_ editing: bool, animated: bool) {     super.setediting(editing,animated:animated)      if self.isediting{          self.editbuttonitem.title = "done"         tableview.setediting(true, animated: true)         tableview.reloaddata()      }     else{         self.editbuttonitem.title = "edit"         tableview.setediting(false, animated: false)      }   } 

in setediting method can access visible rows way

tableview.visiblecells.foreach{ cell in        //define custom cell class        if let customcell = cell as? yourcustomcellcalss{       //call here method show/hide switch or whatever have hiding      customcell.hideswitch()      } } 

but change visible rows, need add checking self.isediting in cellforrowat method rows dequeued after scrolling show/hide switch

if code differs custom cell implementation, please add more of code in question

let me know if you'll need


Comments

Popular posts from this blog

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

php - Cannot override Laravel Spark authentication with own implementation -

What is happening when Matlab is starting a "parallel pool"? -