Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/talisk/skchinacityselector
https://github.com/talisk/skchinacityselector
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/talisk/skchinacityselector
- Owner: talisk
- License: mit
- Created: 2016-01-14T13:39:27.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-19T13:05:53.000Z (almost 9 years ago)
- Last Synced: 2024-11-16T05:16:55.283Z (about 2 months ago)
- Language: Objective-C
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SKChinaCitySelector
![enter image description here](https://img.shields.io/badge/pod-v1.0.0-brightgreen.svg)![enter image description here](https://img.shields.io/badge/Objective--C-compatible-orange.svg) ![enter image description here](https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b4.svg)
## 简介
基于UITableView的中国城市选择。数据来自百度APIStore。
## 使用方法
### 第一步:导入
使用CocoaPods导入,在`Podfile`中添加:
`pod 'SKChinaCitySelector'`
之后终端中执行
``` bash
pod install
```### 第二步:引用
在需要选择城市的文件中,添加头文件:
``` objective-c
#import
```声明协议:
``` objective-c
@interface ViewController ()
```添加回调方法:
``` objective-c
- (void)didSelectCityWithName:(NSString *)cityName {
// 处理选择城市之后的操作
}
```调用:
``` objective-c
CityListViewController *cityListVC = [[CityListViewController alloc] init];
UINavigationController *naviVC = [[UINavigationController alloc] initWithRootViewController:cityListVC];
[self presentViewController:naviVC animated:YES completion:nil];
```