在项目开发中,选择地区的场景很常见,为了方便使用,从项目中摘出了最近写的地址选择控件LYXAreaPicker, 此控件采用本地json解析的方式,省市县三级联动,仿京东的地址选择样式和逻辑。
//创建
LYXAreaPickerView *areaPickerView = [[LYXAreaPickerView alloc] initWithFrame:CGRectZero];
//显示
[areaPickerView showInView:self.view];
//设置选择地址的回调
areaPickerView.selectComplete = ^(NSString * _Nonnull area) {
//显示选择的地址
self.areaTextFiled.text = area;
};