Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an Accordion with UItableview under a UItableview? [closed]

I am working on app which requires a Facebook/Gmail iphone app type menu which i already have with the help of DDMenuController. But now i have requirement where one of the rows needs to show accordion on click with another tableview with 5 rows (all should be clickable and able to push new viewcontrollers). I have seen couple of code sample but nothing seems to fit my requirement, so just trying to put it out here hoping someone has a better solution.

Thanks,

like image 370
Ashutosh Avatar asked Nov 29 '22 13:11

Ashutosh


1 Answers

One of my work had a requirement to have an accordion view but having multiple levels of expansion and collapse of cells like you open/ close your directory structure.

I did a sample on that, I was able to achieve the desired result. The basic concept is the same, I am using the deleteRowsAtIndexPath and insertRowsAtIndex path only but by creating a model object which has a parent children relationship and loading the children into the main array whenever the parent is tapped. I am not good at putting a tutorial so I am sharing my sample code, hope it helps someone.

Code here Accordion_git

Updated Did a SWIFT version of this, not sure whether optimal but it works.

Code here Accordion_SWIFT

Accordion

like image 143
anoop4real Avatar answered Dec 22 '22 06:12

anoop4real