{"id":21027634,"url":"https://github.com/caledoniaproject/didicitypickerviewcontroller","last_synced_at":"2026-03-05T01:32:30.498Z","repository":{"id":146441007,"uuid":"64807630","full_name":"CaledoniaProject/DidiCityPickerViewController","owner":"CaledoniaProject","description":"滴滴出行风格的城市选择器","archived":false,"fork":false,"pushed_at":"2016-08-03T02:17:16.000Z","size":103,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T10:40:31.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CaledoniaProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-03T02:14:57.000Z","updated_at":"2019-07-02T07:43:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"1c3d77ac-ae2c-4e22-9f37-9203f1774224","html_url":"https://github.com/CaledoniaProject/DidiCityPickerViewController","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CaledoniaProject/DidiCityPickerViewController","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaledoniaProject%2FDidiCityPickerViewController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaledoniaProject%2FDidiCityPickerViewController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaledoniaProject%2FDidiCityPickerViewController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaledoniaProject%2FDidiCityPickerViewController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaledoniaProject","download_url":"https://codeload.github.com/CaledoniaProject/DidiCityPickerViewController/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaledoniaProject%2FDidiCityPickerViewController/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30104396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T01:06:53.091Z","status":"ssl_error","status_checked_at":"2026-03-05T01:02:35.679Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T11:51:54.848Z","updated_at":"2026-03-05T01:32:30.480Z","avatar_url":"https://github.com/CaledoniaProject.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 城市选择器\n\n网上搜了一圈，就没找到好用的城市选择器\n\n要么代码臃肿，要么各种崩溃，所以自己写一个吧\n\n风格的话，看了几十个app，还是滴滴的设计最合理，所以按照滴滴的风格做一个，\n\n\u003cimg src=\"https://raw.githubusercontent.com/CaledoniaProject/DidiCityPickerViewController/master/contrib/screen.jpg\" width=\"328px\"\u003e\n\n## 用法\n\n准备工作，\n\n```\n1. 拖拽 `src/CityPickerViewController/` 到你的项目目录，\n2. 修改 `CityPickerViewController.m`，根据你的 navigationBar 风格，修改颜色\n3. 修改 info.Plist，开启定位功能\n```\n\n下面开始使用这个 ViewController，首先实现 `CityPickerDelegate`\n\n```\n#import \u003cUIKit/UIKit.h\u003e\n#import \"CityPickerViewController.h\"\n\n@interface ViewController : UIViewController \u003cCityPickerDelegate\u003e\n\n@end\n```\n\n然后实现对应的函数，\n\n```\n- (void)didPickCity:(NSString *)cityName\n{\n    self.cityLabel.text = cityName;\n}\n```\n\n设置好代理，e.g\n\n```\n- (IBAction)didTapCityButton:(id)sender {\n    CityPickerViewController *vc = [[CityPickerViewController alloc] init];\n    vc.delegate = self;\n    [self.navigationController pushViewController:vc animated:YES];\n}\n```\n\n如果还是有疑问，看 example 目录的测试代码即可\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaledoniaproject%2Fdidicitypickerviewcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaledoniaproject%2Fdidicitypickerviewcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaledoniaproject%2Fdidicitypickerviewcontroller/lists"}