Latest 0.0.4
Homepage https://github.com/KellenYangs/SYCitySelectionController
License MIT
Platforms ios 6.0, requires ARC
Frameworks CoreLocation, MapKit
Authors

快速搭建一个城市选择控制器
感兴趣的给个Star吧…

CocoaPods:

pod 'SYCitySelectionController', '~> 0.0.4'

Usage:

导入头文件

#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 = @[@"上海市", @"天津市", @"北京市", @"杭州市", @"厦门市", @"广州市", @"深圳市"];

自己的城市Dict

NSArray *citys = @[@[@"上海市", @"深圳市"], @[@"天津市"], @[@"北京市"], @[@"杭州市"], @[@"厦门市"], @[@"广州市"]];
NSArray *index = @[@"S", @"T", @"B", @"H", @"X", @"G"];
city.cityDict = [NSDictionary dictionaryWithObjects:citys forKeys:index];

效果图

iteration:

0.0.4 – 发布第一个版本

Other:

使用中有任何问题,请将问题发送给我,谢谢大家帮忙完善!
Email: [email protected]

Latest podspec

{
    "name": "SYCitySelectionController",
    "version": "0.0.4",
    "summary": "Quit create city selection contoller.",
    "description": "Quit create city selection contoller. Easy...",
    "homepage": "https://github.com/KellenYangs/SYCitySelectionController",
    "license": "MIT",
    "authors": {
        "shenyang": "[email protected]"
    },
    "social_media_url": "http://weibo.com/3072322417/profile?topnav=1&wvr=6",
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/KellenYangs/SYCitySelectionController.git",
        "tag": "0.0.4"
    },
    "source_files": "SYCitySelectionController/**/*.{h,m}",
    "resources": "SYCitySelectionController/SYCity.bundle",
    "frameworks": [
        "CoreLocation",
        "MapKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This