views:

73

answers:

1

I am trying to dynamically show/hide table rows/sections when turning a UISwitch on or off. This behavior can be seen when switching wifi on or off on the iphone, as you can see the rows below it being shown or hidden.

Any idea on how this is done?

+1  A: 

Check following methods of UITableView: deleteRowsAtIndexPaths:withRowAnimation, deleteSections:withRowAnimation, insertRowsAtIndexPaths:withRowAnimation, insertSections:withRowAnimation.

sha
With the caveat that this is deleting the rows/sections, not hiding them. This means the numbering changes, which is a minor pain to keep track of...
tc.
Is this how Apple does it?
Nic Hubbard
Well, you can implement "hiding" in your data controller (you still need somehow tie visual representation with data model). Correct me if I'm wrong but I do believe this is how Apple doe it.
sha