Vineeth Joseph
Vineeth Joseph

Reputation: 5187

Show/hide tableviewCells when click on each tableview cell iOS (Accordion UITableView)

I'm trying to implement a tableview that contains categories and subcategories. When loading the tableview it should show categories. When the user click on each category cell it should expand and show subcategories. When the user again click on the particular cell it should hide the subcategory list. The subcategory list count should be different for different category cells. And the subcategory list should be User Interaction Enabled.

I've read the apple documentation but it didn't helped much. Any help will be appreciated. Thanks in advance

Upvotes: 0

Views: 666

Answers (2)

Vineeth Joseph
Vineeth Joseph

Reputation: 5187

I tried a lot of methods but nothing worked well. Last I have found a sample project in Github. The code is here for anyone for future reference. Thanks

Upvotes: 0

Halpo
Halpo

Reputation: 3134

make use of

[self.tableView insertrowsatindexpaths:@[...] withRowAnimation:...];

and

[self.tableView deleteRowsAtIndexPaths:@[...] withRowAnimation:...];

inside your tableView's didSelectRowAtIndexPath

Upvotes: 1

Related Questions