简体   繁体   中英

How to create category and subcategory selection in UITableView in iOS Objective-C

I want to create a table view with category and subcategory selection in UITableView with Objective-C for iOS but I do't know what to search and from were to start. The content of the category and subcategory are dynamic it can be one or more then it will be decided by web service result. and all category should be collapse on tap. It should look like this. 在此处输入图片说明

Any suggestion and help will be appreciated

Edit #1

I have tried something but not working fine here is the code for what i have tried yet. Interest (Category and Subcategory)

If you use UITableView and iOS 8, you can use autolayout to determine the cell height and setup constraints inside cell to hide/show the options. see how to implement dynamic cell height – http://www.raywenderlich.com/87975/dynamic-table-view-cell-height-ios-8-swift ).

I use FXForms to handle such options tables but you need to look little bit deeper into this to be able to subclass the cells properly. Check that out here: https://github.com/nicklockwood/FXForms

I think you should create a CategoryViewController with a 'parentCategory' property.

Initially this property will be empty and it will load all of your base categories. Then when you select a category if it has children you will perform a segue to the same CategoryViewController and set this parentCategory property. You will use this property to load up the child categories.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM