My next task in the development of Fort Collins for Kids is to add the ability to view and edit the Attraction Type. The Attraction Type is stored as a number, but displayed as a string. The values I have in mind are as follows:
- Movie Theater
- Bike Trail
- Hiking Trail
- Arts & Crafts
As stated in a previous post, I’m adding each field into a cell of a UITableView. My first thought was to use a UIPickerView, and get something that looks like this:
(Obviously, the values in the Picker are the Xcode defaults, and not the list I have above)
This is definitely possible, and I set about creating a custom cell that used a UIPickerView as a ContentView.
As I thought about it some more though, it didn’t feel right. I decided to pop into the iOS 7 Settings app, a canonical example of how to use multiple controls inside a UITableView if there ever was one.
I didn’t find any UIPickers inside a UITableView, but I did see a lot of cases where a child UITableView is used as a Picker instead. Take for example, setting the Search Engine preference for Safari:
This looks a lot more elegant to me. The base UI would look like this:
(Again, mocked up as best I could- the code isn’t written yet)
The current value shows on the base Attraction view. Clicking on it will push a new view onto the screen, containing a tableview with a list of the options above. The currently selected option will be checked (the default is “Other”).
Time to get coding!