user1525984
user1525984

Reputation:

Deleting a tableview cell if switch is turned off

I have a table view that show lots of cells (I made it with a storyboard), and in other view there is a switch, I want that when this switch is turned off, the cell that it represents disappears from the table view, the view with the switch is connected to the tableview by a tab bar.

How do I do it? I don't have idea!

my storyboard

Upvotes: 0

Views: 85

Answers (1)

mask8
mask8

Reputation: 3638

When the switch is turned off, call [tableView reloadData] and in your tableView:numberOfRowsInSection: check the switch's property to see whether it is turned off. If turned off, return 0.

Upvotes: 1

Related Questions