Reputation: 878
I want to create a menu with submenus for an iOS app.
I dont know what the best approach would be, and am looking for some advice.
I want to move things from one place to another.
To:
From:
I have country, state, city.
When you click on the tableview that has to and from in it, i want a submenu that shows the list of countries, then when a country is click, a list of states, etc.
Should i have a tableview for each menu type?
countryView
stateView
cityView
Then inside the cityView, when one is selected, i pass that selection back to the main table, with to and from, and display it as the detail for that cell.
Is this the best approach?
Thanks for any advice.
Upvotes: 0
Views: 553
Reputation: 4168
The most HIG-compliant would be like so:
The 'From' and 'To' cells trigger a modal segue to the 'Choose a City' table view controller.
The choose a city controller declares a delegate property and a protocol with a suitable method. The 'Moving' view controller can set itself as the delegate in the prepareForSegue:
method.
The Choose a City controller can use a suitable string-based search approach to filter through the list of cities. When the user taps a city, the controller dismisses itself and sends a message to the delegate telling it about the location selected. The delegate (here, the 'Moving' view controller) accordingly updates the location shown by the 'From' or 'To' fields.
Put a 'Done' button wherever the controller needs to be explicitly dismissed to continue with the workflow, and a 'Cancel' button wherever it is dismissed implicitly.
Upvotes: 1