【Summary】
This article mainly introduces the basic usage of UIPickerView, we can obtain address information by selecting the provinces ,cities and districts.
【Explanation and Effect Picture】
- The cities and districts will change when you switch the province
- Districts will change when you switch the city
- Click the confirm button,then the information label will show the address you choose
【Preparation】
Before we start ,we need a plist which contains all address information.
The data format is as follows:
This is part of the source code:
<dict>
<key>河北省</key>
<dict>
<key>石家庄市</key>
<array>
<string>长安区</string>
<string>桥东区</string>
<string>桥西区</string>
<string>新华区</string>
<string>井陉矿区</string>
<string>裕华区</string>
<string>井陉县</string>
<string>正定县</string>
<string>栾城县</string>
<string>行唐县</string>
<string>灵寿县</string>
<string>高邑县</string>
<string>深泽县</string>
<string>赞皇县</string>
<string>无极县</string>
<string>平山县</string>
<string>元氏县</string>
<string>赵县</string>
<string>辛集市</string>
<string>藁城市</string>
<string>晋州市</string>
<string>新乐市</string>
<string>鹿泉市</string>
</array>
<key>唐山市</key>
<array>
<string>路南区</string>
<string>路北区</string>
<string>古冶区</string>
<string>开平区</string>
<string>丰南区</string>
<string>丰润区</string>
<string>滦县</string>
<string>滦南县</string>
<string>乐亭县</string>
<string>迁西县</string>
<string>玉田县</string>
<string>唐海县</string>
<string>遵化市</string>
<string>迁安市</string>
</array>
<key>秦皇岛市</key>
<array>
<string>海港区</string>
<string>山海关区</string>
<string>北戴河区</string>
<string>青龙满族自治县</string>
<string>