swift3-省、市、区地址选择器,plist格式数据(UIPickerView)

【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】
  1. The cities and districts will change when you switch the province
  2. Districts will change when you switch the city
  3. 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>
            <str
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值