快速搭建城市选择控制器
导入头文件
#import "SYCitySelectionController.h"
SYCitySelectionController *city = [SYCitySelectionController new];
选择城市后回调
city.selectCity = ^(NSString *city) {
NSLog(@"%@", city);
[self.locateBarButton setTitle:city];
};
当前位置
city.currentCityName = @"厦门市";
开启定位(上述设置无效,请在真机上调试)
city.openLocation = YES;
返回按钮
city.currentCityName = @"厦门市";
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
[b setTitle:@"Click Me Back" forState:UIControlStateNormal];
[b sizeToFit];
b.backgroundColor = [UIColor cyanColor];
city.backView = b;
热门城市
city.hotCitys = @[@"上海市", @"天津市", @"北京市", @"杭州市", @"厦门市", @"广州市", @"深圳市"];
所有城市
city.citys = @[@"上海市", @"天津市", @"北京市", @"杭州市", @"厦门市", @"广州市", @"深圳市"];
自定义城市字典
NSArray *citys = @[@[@"上海市", @"深圳市"], @[@"天津市"], @[@"北京市"], @[@"杭州市"], @[@"厦门市"], @[@"广州市"]];
NSArray *index = @[@"S", @"T", @"B", @"H", @"X", @"G"];
city.cityDict = [NSDictionary dictionaryWithObjects:citys forKeys:index];
0.0.4 - 发布第一个版本
使用中如果有任何问题,请将问题发送给我,感谢大家的帮助!邮箱:[email protected]