I made sidemenu. but i have some question. when i clicked button on the sidemenu, appear an other side button. look like this image
when i clicked sidemenu button, appear subSidemenu. I don't know how to say this function.
I made sidemenu. but i have some question. when i clicked button on the sidemenu, appear an other side button. look like this image
when i clicked sidemenu button, appear subSidemenu. I don't know how to say this function.
Firstly if you want to show a list of values which are collapsable then you need a UITableView
. Make your SideMenu
s as sections and rows as SubSideMenu
s.
And you would like to have that feature when user tap so implement tableview's numberOfRows
method like this
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let sideMenu = mySideMenus[section]
return sideMenu.isCollapsed ? 0 : sideMenu.subSideMenus.count
}
And when the header is tapped you need to call tableView.reloadSections(sections: [IndexSet], with: UITableViewRowAnimation)
to reload that section.
I don't know if this is was your exact question but sidebar is easy to implement for your app. And you don't need buttons when working with tableView.