I am really getting disappointed that's why I ask this question, I found tutorials online for Collapsible TableView but they are with populating the cells with an array of Strings or something similar.
I want to make an Accordion like this with Swift 3
,
for some days already I tried a lot of things with UITableViewController
because apparently that's the only thing you can make collapsible if you want different cells.
Anyway I started to do it but as I asked my question here I cannot show different UI
s in each Cell
of each Section
.
I am sure there's a way to do it, anyone has any suggestions how to make this work?
I thought maybe there's another way to do it (e.g. with ScrollView
or something)
Here is how you could implement it with
UIStackView
:UIStackView
via storyboardUIButton
as the first subview within theUIStackView
UILabel
s as the second, third... subview within theUIStackView
IBAction
for theUIButton
(the first subview)Implement the
IBAction
like this:Create multiple
UIStackView
s like this (you can always use the sameIBAction
for theUIButton
) and embed all of them in a parent (vertical)UIStackView
to create a view like in your screenshot.Feel free to ask if anything is unclear.
Result: