多级城市联动选择器 - 可设置默认城市
一级 省份
二级 省份+城市
三级 省份+城市+区
Demo使用例子
class ViewController: UIViewController {
@IBOutlet weak var locationLabel: UILabel!
@IBAction func level1BtnClick(_ sender: UIButton) {
let locationPicker = SwiftLocationPicker("广东省") { address in
self.locationLabel.text = address
}
locationPicker.show()
}
@IBAction func level2BtnClick(_ sender: UIButton) {
let locationPicker = SwiftLocationPicker("广东省","广州市",title:"城市选择") { address in
self.locationLabel.text = address
}
locationPicker.isAppearLociton = true
locationPicker.show()
}
@IBAction func level3BtnClick(_ sender: UIButton) {
let locationPicker = SwiftLocationPicker("广东省","广州市","天河区") { address in
self.locationLabel.text = address
}
locationPicker.show()
// let locationPicker2 = SwiftLocationPicker(.level3(province: "广东省", city: "广州市", town: "天河区")) { address in
// self.locationLabel.text = address
// }
// locationPicker2.show()
}
}