So I have been searching a lot and couldn't find an appropriate answer to my question, i.e. Consider a tableview which needs to have collapsable Section Headers. When the TableView appears the Section Headers are all collapsed. When tapped on one of the Section Headers it expands to give Form cell that is a Custom View and contains TextFields, Buttons, Labels, Switches etc. Similarly when any other Section Header is tapped, the first Section Header collapses and the current one opens and has another Custom View with different TextFields, Buttons, Activity Indicators etc. All have to in a table view so the collapse / expand area is the same and helps user interact easily.
Also please let me know if my approach is alright as well, like I'd like to know if similar Section Headers can have separate Cells who have different Views as subviews entertaining the required funtionality.
Please help. I wish to create the following:
Put a
UIButton
on the header cell and give an action to it like this:In
viewForHeader
method:Then,
In
numberofRows
:This worked for me, I hope this works for you too.