I need to be able to select a village in Thailand, based first off of Province, Region, District, and then finally selecting the village. Basically you select the Province first, and that in turn shows all the Regions in that Province, and so on and so forth. I have a spreadsheet at http://www.316apps.com/Fritch/dropdown.xlsx that has this information, but I am not sure how to convert that into a datasource and implement it in UIPickerViews. Any advice on this?
Asked
Active
Viewed 87 times
2
-
I would keep the data in a plist file. Map the "overarching" area to an array of its subset of areas. (ex. `[provinceName : [regionNames]]`). When a province name is selected, you should lazy load its associated region names (repeat the same steps as you approach village). – BenJammin Sep 22 '16 at 16:15
-
If the dataset is large enough, you should probably look into parsing it into Core Data (write a separate utility app that takes an input file and fills in a Core Data model). As for UIPickerViews, I'd recommend not using them in this manner as they will be slower for the user than having side by side tables. – Glenn Howes Sep 22 '16 at 16:45
-
@GlennHowes I've never done anything like this before, are there any guides or tutorials for sorting it all out? – user717452 Sep 22 '16 at 18:18
-
For what? Putting things into Core Data? I'm sure there's something on Ray Wenderlich. – Glenn Howes Sep 23 '16 at 14:51
-
@GlennHowes Reading it again, your suggestion is to write an app for the sole purpose of making a core data model, and then doing something with it? Don't think that really seems like a good way to do it. – user717452 Sep 24 '16 at 20:55
-
@BenJammin What do you mean by lazy load? Any suggestions for getting the spreadsheet into a PLIST? – user717452 Sep 24 '16 at 20:55
-
@user717452 you can use an online utility like [this](http://exceltoplist.herokuapp.com/) . Lazy loading means that resources are only loaded as needed. For example, you wouldn't need to load all regions, districts and villages; only the ones relevant to the chosen Province. – BenJammin Sep 24 '16 at 23:49
-
@BenJammin Unfortunately that would not accept the spreadsheet I have. – user717452 Sep 29 '16 at 13:03