├── .DS_Store ├── .gitignore ├── Demo.gif ├── LICENSE ├── README.md ├── TLCityPicker.podspec ├── TLCityPicker ├── CityData.plist ├── TLCity.h ├── TLCity.m ├── TLCityGroupCell.h ├── TLCityGroupCell.m ├── TLCityHeaderView.h ├── TLCityHeaderView.m ├── TLCityPickerController.h ├── TLCityPickerController.m ├── TLCityPickerDelegate.h ├── TLCityPickerSearchResultController.h └── TLCityPickerSearchResultController.m ├── TLCityPickerDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── TLCityPickerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Info.plist ├── Launch Screen.xib ├── Main.storyboard ├── ViewController.h ├── ViewController.m └── main.m /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbl00c/TLCityPicker/2df536ea64a98464004e356587adb13ebe020db1/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbl00c/TLCityPicker/2df536ea64a98464004e356587adb13ebe020db1/Demo.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Adam Fish 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #TLCityPicker 2 | 中国城市选择器 3 | 4 | ## Usage 5 | ```c 6 | TLCityPickerController *cityPickerVC = [[TLCityPickerController alloc] init]; 7 | [cityPickerVC setDelegate:self]; 8 | 9 | // 设置定位城市 10 | cityPickerVC.locationCityID = @"1400010000"; 11 | 12 | // 最近访问城市,如果不设置,将自动管理 13 | // cityPickerVC.commonCitys = [[NSMutableArray alloc] initWithArray: @[@"1400010000", @"100010000"]]; 14 | 15 | // 热门城市,需手动设置 16 | cityPickerVC.hotCitys = @[@"100010000", @"200010000", @"300210000", @"600010000", @"300110000"]; 17 | 18 | // 支持push、present方式跳入,但需要有UINavigationController 19 | [self presentViewController:[[UINavigationController alloc] initWithRootViewController:cityPickerVC] animated:YES completion:^{ 20 | }]; 21 | ``` 22 | 23 | ## DEMO 24 | ![image](https://github.com/tbl00c/TLCityPicker/blob/master/Demo.gif) 25 | -------------------------------------------------------------------------------- /TLCityPicker.podspec: -------------------------------------------------------------------------------- 1 | #TLCityPicker.podspec 2 | Pod::Spec.new do |s| 3 | s.name = "TLCityPicker" 4 | s.version = "1.0.0" 5 | s.summary = "中国城市选择器,自动管理最近访问城市,快速集成。" 6 | 7 | s.homepage = "https://github.com/tbl00c/TLCityPicker" 8 | s.license = { :type => "MIT", :file => "LICENSE"} 9 | s.author = { "libokun" => "libokun@126.com" } 10 | s.platform = :ios, "7.0" 11 | s.ios.deployment_target = "7.0" 12 | s.source = { :git => "https://github.com/tbl00c/TLCityPicker.git", :tag => s.version} 13 | s.source_files = 'TLCityPicker/*.{h,m,plist}' 14 | s.requires_arc = true 15 | end 16 | -------------------------------------------------------------------------------- /TLCityPicker/CityData.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | citys 7 | 8 | 9 | city_key 10 | 600280000 11 | city_name 12 | 安吉市 13 | initials 14 | aj 15 | pinyin 16 | anji 17 | short_name 18 | 安吉 19 | 20 | 21 | city_key 22 | 1000090000 23 | city_name 24 | 安康市 25 | initials 26 | ak 27 | pinyin 28 | ankang 29 | short_name 30 | 安康 31 | 32 | 33 | city_key 34 | 1500080000 35 | city_name 36 | 安庆市 37 | initials 38 | aq 39 | pinyin 40 | anqing 41 | short_name 42 | 安庆 43 | 44 | 45 | city_key 46 | 1300030000 47 | city_name 48 | 鞍山市 49 | initials 50 | as 51 | pinyin 52 | anshan 53 | short_name 54 | 鞍山 55 | 56 | 57 | city_key 58 | 2000050000 59 | city_name 60 | 安阳市 61 | initials 62 | ay 63 | pinyin 64 | anyang 65 | short_name 66 | 安阳 67 | 68 | 69 | initial 70 | A 71 | 72 | 73 | citys 74 | 75 | 76 | city_key 77 | 2300080000 78 | city_name 79 | 白城市 80 | initials 81 | bc 82 | pinyin 83 | baicheng 84 | short_name 85 | 白城 86 | 87 | 88 | city_key 89 | 2300060000 90 | city_name 91 | 白山市 92 | initials 93 | bs 94 | pinyin 95 | baishan 96 | short_name 97 | 白山 98 | 99 | 100 | city_key 101 | 3000040000 102 | city_name 103 | 白银市 104 | initials 105 | by 106 | pinyin 107 | baiyin 108 | short_name 109 | 白银 110 | 111 | 112 | city_key 113 | 1800060000 114 | city_name 115 | 保定市 116 | initials 117 | bd 118 | pinyin 119 | baoding 120 | short_name 121 | 保定 122 | 123 | 124 | city_key 125 | 1000030000 126 | city_name 127 | 宝鸡市 128 | initials 129 | bj 130 | pinyin 131 | baoji 132 | short_name 133 | 宝鸡 134 | 135 | 136 | city_key 137 | 2500050000 138 | city_name 139 | 北海市 140 | initials 141 | bh 142 | pinyin 143 | beihai 144 | short_name 145 | 北海 146 | 147 | 148 | city_key 149 | 100010000 150 | city_name 151 | 北京市 152 | initials 153 | bj 154 | pinyin 155 | beijing 156 | short_name 157 | 北京 158 | 159 | 160 | city_key 161 | 1500030000 162 | city_name 163 | 蚌埠市 164 | initials 165 | bb 166 | pinyin 167 | bengbu 168 | short_name 169 | 蚌埠 170 | 171 | 172 | city_key 173 | 1300050000 174 | city_name 175 | 本溪市 176 | initials 177 | bx 178 | pinyin 179 | benxi 180 | short_name 181 | 本溪 182 | 183 | 184 | initial 185 | B 186 | 187 | 188 | citys 189 | 190 | 191 | city_key 192 | 1800090000 193 | city_name 194 | 沧州市 195 | initials 196 | cz 197 | pinyin 198 | cangzhou 199 | short_name 200 | 沧州 201 | 202 | 203 | city_key 204 | 2300010000 205 | city_name 206 | 长春市 207 | initials 208 | zc 209 | pinyin 210 | changchun 211 | short_name 212 | 长春 213 | 214 | 215 | city_key 216 | 1200070000 217 | city_name 218 | 常德市 219 | initials 220 | cd 221 | pinyin 222 | changde 223 | short_name 224 | 常德 225 | 226 | 227 | city_key 228 | 1200010000 229 | city_name 230 | 长沙市 231 | initials 232 | zs 233 | pinyin 234 | changsha 235 | short_name 236 | 长沙 237 | 238 | 239 | city_key 240 | 700150000 241 | city_name 242 | 常熟市 243 | initials 244 | cs 245 | pinyin 246 | changshu 247 | short_name 248 | 常熟 249 | 250 | 251 | city_key 252 | 600240000 253 | city_name 254 | 长兴市 255 | initials 256 | zx 257 | pinyin 258 | changxing 259 | short_name 260 | 长兴 261 | 262 | 263 | city_key 264 | 2100040000 265 | city_name 266 | 长治市 267 | initials 268 | zz 269 | pinyin 270 | changzhi 271 | short_name 272 | 长治 273 | 274 | 275 | city_key 276 | 700040000 277 | city_name 278 | 常州市 279 | initials 280 | cz 281 | pinyin 282 | changzhou 283 | short_name 284 | 常州 285 | 286 | 287 | city_key 288 | 1500130000 289 | city_name 290 | 巢湖市 291 | initials 292 | ch 293 | pinyin 294 | chaohu 295 | short_name 296 | 巢湖 297 | 298 | 299 | city_key 300 | 1300130000 301 | city_name 302 | 朝阳市 303 | initials 304 | cy 305 | pinyin 306 | chaoyang 307 | short_name 308 | 朝阳 309 | 310 | 311 | city_key 312 | 300190000 313 | city_name 314 | 潮州市 315 | initials 316 | cz 317 | pinyin 318 | chaozhou 319 | short_name 320 | 潮州 321 | 322 | 323 | city_key 324 | 1800080000 325 | city_name 326 | 承德市 327 | initials 328 | cd 329 | pinyin 330 | chengde 331 | short_name 332 | 承德 333 | 334 | 335 | city_key 336 | 800010000 337 | city_name 338 | 成都市 339 | initials 340 | cd 341 | pinyin 342 | chengdu 343 | short_name 344 | 成都 345 | 346 | 347 | city_key 348 | 1500160000 349 | city_name 350 | 池州市 351 | initials 352 | cz 353 | pinyin 354 | chizhou 355 | short_name 356 | 池州 357 | 358 | 359 | city_key 360 | 900010000 361 | city_name 362 | 重庆市 363 | initials 364 | cq 365 | pinyin 366 | chongqing 367 | short_name 368 | 重庆 369 | 370 | 371 | city_key 372 | 600340000 373 | city_name 374 | 淳安市 375 | initials 376 | ca 377 | pinyin 378 | chunan 379 | short_name 380 | 淳安 381 | 382 | 383 | city_key 384 | 1500100000 385 | city_name 386 | 滁州市 387 | initials 388 | cz 389 | pinyin 390 | chuzhou 391 | short_name 392 | 滁州 393 | 394 | 395 | city_key 396 | 600120000 397 | city_name 398 | 慈溪市 399 | initials 400 | cx 401 | pinyin 402 | cixi 403 | short_name 404 | 慈溪 405 | 406 | 407 | initial 408 | C 409 | 410 | 411 | citys 412 | 413 | 414 | city_key 415 | 700330000 416 | city_name 417 | 大丰县 418 | initials 419 | df 420 | pinyin 421 | dafeng 422 | short_name 423 | 大丰 424 | 425 | 426 | city_key 427 | 2800130000 428 | city_name 429 | 大理白族自治州 430 | initials 431 | dlbz 432 | pinyin 433 | dali 434 | short_name 435 | 大理白族 436 | 437 | 438 | city_key 439 | 1300010000 440 | city_name 441 | 大连市 442 | initials 443 | dl 444 | pinyin 445 | dalian 446 | short_name 447 | 大连 448 | 449 | 450 | city_key 451 | 1300060000 452 | city_name 453 | 丹东市 454 | initials 455 | dd 456 | pinyin 457 | dandong 458 | short_name 459 | 丹东 460 | 461 | 462 | city_key 463 | 2600050000 464 | city_name 465 | 儋州市 466 | initials 467 | dz 468 | pinyin 469 | danzhou 470 | short_name 471 | 儋州 472 | 473 | 474 | city_key 475 | 1100060000 476 | city_name 477 | 大庆市 478 | initials 479 | dq 480 | pinyin 481 | daqing 482 | short_name 483 | 大庆 484 | 485 | 486 | city_key 487 | 2100020000 488 | city_name 489 | 大同市 490 | initials 491 | dt 492 | pinyin 493 | datong 494 | short_name 495 | 大同 496 | 497 | 498 | city_key 499 | 800150000 500 | city_name 501 | 达州市 502 | initials 503 | dz 504 | pinyin 505 | dazhou 506 | short_name 507 | 达州 508 | 509 | 510 | city_key 511 | 2000190000 512 | city_name 513 | 登封市 514 | initials 515 | df 516 | pinyin 517 | dengfeng 518 | short_name 519 | 登封 520 | 521 | 522 | city_key 523 | 600270000 524 | city_name 525 | 德清市 526 | initials 527 | dq 528 | pinyin 529 | deqing 530 | short_name 531 | 德清 532 | 533 | 534 | city_key 535 | 800050000 536 | city_name 537 | 德阳市 538 | initials 539 | dy 540 | pinyin 541 | deyang 542 | short_name 543 | 德阳 544 | 545 | 546 | city_key 547 | 1400140000 548 | city_name 549 | 德州市 550 | initials 551 | dz 552 | pinyin 553 | dezhou 554 | short_name 555 | 德州 556 | 557 | 558 | city_key 559 | 300170000 560 | city_name 561 | 东莞市 562 | initials 563 | dg 564 | pinyin 565 | dongguan 566 | short_name 567 | 东莞 568 | 569 | 570 | city_key 571 | 600310000 572 | city_name 573 | 东阳市 574 | initials 575 | dy 576 | pinyin 577 | dongyang 578 | short_name 579 | 东阳 580 | 581 | 582 | city_key 583 | 1400050000 584 | city_name 585 | 东营市 586 | initials 587 | dy 588 | pinyin 589 | dongying 590 | short_name 591 | 东营 592 | 593 | 594 | city_key 595 | 2300110000 596 | city_name 597 | 敦化市 598 | initials 599 | dh 600 | pinyin 601 | dunhua 602 | short_name 603 | 敦化 604 | 605 | 606 | initial 607 | D 608 | 609 | 610 | citys 611 | 612 | 613 | city_key 614 | 800220000 615 | city_name 616 | 峨眉山市 617 | initials 618 | ems 619 | pinyin 620 | emeishan 621 | short_name 622 | 峨眉山 623 | 624 | 625 | city_key 626 | 400190000 627 | city_name 628 | 恩施市 629 | initials 630 | es 631 | pinyin 632 | enshi 633 | short_name 634 | 恩施 635 | 636 | 637 | initial 638 | E 639 | 640 | 641 | citys 642 | 643 | 644 | city_key 645 | 300060000 646 | city_name 647 | 佛山市 648 | initials 649 | fs 650 | pinyin 651 | foshan 652 | short_name 653 | 佛山 654 | 655 | 656 | city_key 657 | 1900130000 658 | city_name 659 | 福清市 660 | initials 661 | fq 662 | pinyin 663 | fuqing 664 | short_name 665 | 福清 666 | 667 | 668 | city_key 669 | 1300040000 670 | city_name 671 | 抚顺市 672 | initials 673 | fs 674 | pinyin 675 | fushun 676 | short_name 677 | 抚顺 678 | 679 | 680 | city_key 681 | 1300090000 682 | city_name 683 | 阜新市 684 | initials 685 | fx 686 | pinyin 687 | fuxin 688 | short_name 689 | 阜新 690 | 691 | 692 | city_key 693 | 1500110000 694 | city_name 695 | 阜阳市 696 | initials 697 | fy 698 | pinyin 699 | fuyang 700 | short_name 701 | 阜阳 702 | 703 | 704 | city_key 705 | 600140000 706 | city_name 707 | 富阳市 708 | initials 709 | fy 710 | pinyin 711 | fuyang1 712 | short_name 713 | 富阳 714 | 715 | 716 | city_key 717 | 1900010000 718 | city_name 719 | 福州市 720 | initials 721 | fz 722 | pinyin 723 | fuzhou 724 | short_name 725 | 福州 726 | 727 | 728 | initial 729 | F 730 | 731 | 732 | citys 733 | 734 | 735 | city_key 736 | 2400070000 737 | city_name 738 | 赣州市 739 | initials 740 | gz 741 | pinyin 742 | ganzhou 743 | short_name 744 | 赣州 745 | 746 | 747 | city_key 748 | 2000200000 749 | city_name 750 | 巩义市 751 | initials 752 | gy 753 | pinyin 754 | gongyi 755 | short_name 756 | 巩义 757 | 758 | 759 | city_key 760 | 800070000 761 | city_name 762 | 广元市 763 | initials 764 | gy 765 | pinyin 766 | guangyuan 767 | short_name 768 | 广元 769 | 770 | 771 | city_key 772 | 300110000 773 | city_name 774 | 广州市 775 | initials 776 | gz 777 | pinyin 778 | guangzhou 779 | short_name 780 | 广州 781 | 782 | 783 | city_key 784 | 2500030000 785 | city_name 786 | 桂林市 787 | initials 788 | gl 789 | pinyin 790 | guilin 791 | short_name 792 | 桂林 793 | 794 | 795 | city_key 796 | 2700010000 797 | city_name 798 | 贵阳市 799 | initials 800 | gy 801 | pinyin 802 | guiyang 803 | short_name 804 | 贵阳 805 | 806 | 807 | initial 808 | G 809 | 810 | 811 | citys 812 | 813 | 814 | city_key 815 | 1100010000 816 | city_name 817 | 哈尔滨市 818 | initials 819 | heb 820 | pinyin 821 | haerbin 822 | short_name 823 | 哈尔滨 824 | 825 | 826 | city_key 827 | 700310000 828 | city_name 829 | 海安县 830 | initials 831 | ha 832 | pinyin 833 | haian 834 | short_name 835 | 海安 836 | 837 | 838 | city_key 839 | 2600010000 840 | city_name 841 | 海口市 842 | initials 843 | hk 844 | pinyin 845 | haikou 846 | short_name 847 | 海口 848 | 849 | 850 | city_key 851 | 700170000 852 | city_name 853 | 海门市 854 | initials 855 | hm 856 | pinyin 857 | haimen 858 | short_name 859 | 海门 860 | 861 | 862 | city_key 863 | 600370000 864 | city_name 865 | 海宁市 866 | initials 867 | hn 868 | pinyin 869 | haining 870 | short_name 871 | 海宁 872 | 873 | 874 | city_key 875 | 1400260000 876 | city_name 877 | 海阳市 878 | initials 879 | hy 880 | pinyin 881 | haiyang 882 | short_name 883 | 海阳 884 | 885 | 886 | city_key 887 | 1800040000 888 | city_name 889 | 邯郸市 890 | initials 891 | hd 892 | pinyin 893 | handan 894 | short_name 895 | 邯郸 896 | 897 | 898 | city_key 899 | 600010000 900 | city_name 901 | 杭州市 902 | initials 903 | hz 904 | pinyin 905 | hangzhou 906 | short_name 907 | 杭州 908 | 909 | 910 | city_key 911 | 1000070000 912 | city_name 913 | 汉中市 914 | initials 915 | hz 916 | pinyin 917 | hanzhong 918 | short_name 919 | 汉中 920 | 921 | 922 | city_key 923 | 2000060000 924 | city_name 925 | 鹤壁市 926 | initials 927 | hb 928 | pinyin 929 | hebi 930 | short_name 931 | 鹤壁 932 | 933 | 934 | city_key 935 | 1500010000 936 | city_name 937 | 合肥市 938 | initials 939 | hf 940 | pinyin 941 | hefei 942 | short_name 943 | 合肥 944 | 945 | 946 | city_key 947 | 1100040000 948 | city_name 949 | 鹤岗市 950 | initials 951 | hg 952 | pinyin 953 | hegang 954 | short_name 955 | 鹤岗 956 | 957 | 958 | city_key 959 | 1100110000 960 | city_name 961 | 黑河市 962 | initials 963 | hh 964 | pinyin 965 | heihe 966 | short_name 967 | 黑河 968 | 969 | 970 | city_key 971 | 1800110000 972 | city_name 973 | 衡水市 974 | initials 975 | hs 976 | pinyin 977 | hengshui 978 | short_name 979 | 衡水 980 | 981 | 982 | city_key 983 | 1200040000 984 | city_name 985 | 衡阳市 986 | initials 987 | hy 988 | pinyin 989 | hengyang 990 | short_name 991 | 衡阳 992 | 993 | 994 | city_key 995 | 300140000 996 | city_name 997 | 河源市 998 | initials 999 | hy 1000 | pinyin 1001 | heyuan 1002 | short_name 1003 | 河源 1004 | 1005 | 1006 | city_key 1007 | 1400170000 1008 | city_name 1009 | 菏泽市 1010 | initials 1011 | hz 1012 | pinyin 1013 | heze 1014 | short_name 1015 | 菏泽 1016 | 1017 | 1018 | city_key 1019 | 2200010000 1020 | city_name 1021 | 呼和浩特市 1022 | initials 1023 | hhht 1024 | pinyin 1025 | hohhot 1026 | short_name 1027 | 呼和浩特 1028 | 1029 | 1030 | city_key 1031 | 2300100000 1032 | city_name 1033 | 桦甸市 1034 | initials 1035 | hd 1036 | pinyin 1037 | huadian 1038 | short_name 1039 | 桦甸 1040 | 1041 | 1042 | city_key 1043 | 700080000 1044 | city_name 1045 | 淮安市 1046 | initials 1047 | ha 1048 | pinyin 1049 | huaian 1050 | short_name 1051 | 淮安 1052 | 1053 | 1054 | city_key 1055 | 1500060000 1056 | city_name 1057 | 淮北市 1058 | initials 1059 | hb 1060 | pinyin 1061 | huaibei 1062 | short_name 1063 | 淮北 1064 | 1065 | 1066 | city_key 1067 | 1200120000 1068 | city_name 1069 | 怀化市 1070 | initials 1071 | hh 1072 | pinyin 1073 | huaihua 1074 | short_name 1075 | 怀化 1076 | 1077 | 1078 | city_key 1079 | 1500040000 1080 | city_name 1081 | 淮南市 1082 | initials 1083 | hn 1084 | pinyin 1085 | huainan 1086 | short_name 1087 | 淮南 1088 | 1089 | 1090 | city_key 1091 | 400160000 1092 | city_name 1093 | 黄冈市 1094 | initials 1095 | hg 1096 | pinyin 1097 | huanggang 1098 | short_name 1099 | 黄冈 1100 | 1101 | 1102 | city_key 1103 | 1500090000 1104 | city_name 1105 | 黄山市 1106 | initials 1107 | hs 1108 | pinyin 1109 | huangshan 1110 | short_name 1111 | 黄山 1112 | 1113 | 1114 | city_key 1115 | 400020000 1116 | city_name 1117 | 黄石市 1118 | initials 1119 | hs 1120 | pinyin 1121 | huangshi 1122 | short_name 1123 | 黄石 1124 | 1125 | 1126 | city_key 1127 | 300010000 1128 | city_name 1129 | 惠州市 1130 | initials 1131 | hz 1132 | pinyin 1133 | huizhou 1134 | short_name 1135 | 惠州 1136 | 1137 | 1138 | city_key 1139 | 1300140000 1140 | city_name 1141 | 葫芦岛市 1142 | initials 1143 | hld 1144 | pinyin 1145 | huludao 1146 | short_name 1147 | 葫芦岛 1148 | 1149 | 1150 | city_key 1151 | 600050000 1152 | city_name 1153 | 湖州市 1154 | initials 1155 | hz 1156 | pinyin 1157 | huzhou 1158 | short_name 1159 | 湖州 1160 | 1161 | 1162 | initial 1163 | H 1164 | 1165 | 1166 | citys 1167 | 1168 | 1169 | city_key 1170 | 1100080000 1171 | city_name 1172 | 佳木斯市 1173 | initials 1174 | jms 1175 | pinyin 1176 | jiamusi 1177 | short_name 1178 | 佳木斯 1179 | 1180 | 1181 | city_key 1182 | 600330000 1183 | city_name 1184 | 建德市 1185 | initials 1186 | jd 1187 | pinyin 1188 | jiande 1189 | short_name 1190 | 建德 1191 | 1192 | 1193 | city_key 1194 | 300070000 1195 | city_name 1196 | 江门市 1197 | initials 1198 | jm 1199 | pinyin 1200 | jiangmen 1201 | short_name 1202 | 江门 1203 | 1204 | 1205 | city_key 1206 | 700160000 1207 | city_name 1208 | 江阴市 1209 | initials 1210 | jy 1211 | pinyin 1212 | jiangyin 1213 | short_name 1214 | 江阴 1215 | 1216 | 1217 | city_key 1218 | 2000080000 1219 | city_name 1220 | 焦作市 1221 | initials 1222 | jz 1223 | pinyin 1224 | jiaozuo 1225 | short_name 1226 | 焦作 1227 | 1228 | 1229 | city_key 1230 | 600260000 1231 | city_name 1232 | 嘉善市 1233 | initials 1234 | js 1235 | pinyin 1236 | jiashan 1237 | short_name 1238 | 嘉善 1239 | 1240 | 1241 | city_key 1242 | 600040000 1243 | city_name 1244 | 嘉兴市 1245 | initials 1246 | jx 1247 | pinyin 1248 | jiaxing 1249 | short_name 1250 | 嘉兴 1251 | 1252 | 1253 | city_key 1254 | 1500190000 1255 | city_name 1256 | 界首市 1257 | initials 1258 | js 1259 | pinyin 1260 | jieshou 1261 | short_name 1262 | 界首 1263 | 1264 | 1265 | city_key 1266 | 300200000 1267 | city_name 1268 | 揭阳市 1269 | initials 1270 | jy 1271 | pinyin 1272 | jieyang 1273 | short_name 1274 | 揭阳 1275 | 1276 | 1277 | city_key 1278 | 2300020000 1279 | city_name 1280 | 吉林市 1281 | initials 1282 | jl 1283 | pinyin 1284 | jilin 1285 | short_name 1286 | 吉林 1287 | 1288 | 1289 | city_key 1290 | 1400020000 1291 | city_name 1292 | 济南市 1293 | initials 1294 | jn 1295 | pinyin 1296 | jinan 1297 | short_name 1298 | 济南 1299 | 1300 | 1301 | city_key 1302 | 2100050000 1303 | city_name 1304 | 晋城市 1305 | initials 1306 | jc 1307 | pinyin 1308 | jincheng 1309 | short_name 1310 | 晋城 1311 | 1312 | 1313 | city_key 1314 | 2400020000 1315 | city_name 1316 | 景德镇市 1317 | initials 1318 | jdz 1319 | pinyin 1320 | jindezhen 1321 | short_name 1322 | 景德镇 1323 | 1324 | 1325 | city_key 1326 | 700250000 1327 | city_name 1328 | 靖江市 1329 | initials 1330 | jj 1331 | pinyin 1332 | jingjiang 1333 | short_name 1334 | 靖江 1335 | 1336 | 1337 | city_key 1338 | 400150000 1339 | city_name 1340 | 荆州市 1341 | initials 1342 | jz 1343 | pinyin 1344 | jingzhou 1345 | short_name 1346 | 荆州 1347 | 1348 | 1349 | city_key 1350 | 600070000 1351 | city_name 1352 | 金华市 1353 | initials 1354 | jh 1355 | pinyin 1356 | jinhua 1357 | short_name 1358 | 金华 1359 | 1360 | 1361 | city_key 1362 | 1400080000 1363 | city_name 1364 | 济宁市 1365 | initials 1366 | jn 1367 | pinyin 1368 | jining 1369 | short_name 1370 | 济宁 1371 | 1372 | 1373 | city_key 1374 | 1900100000 1375 | city_name 1376 | 晋江市 1377 | initials 1378 | jj 1379 | pinyin 1380 | jinjiang 1381 | short_name 1382 | 晋江 1383 | 1384 | 1385 | city_key 1386 | 700260000 1387 | city_name 1388 | 金坛市 1389 | initials 1390 | jt 1391 | pinyin 1392 | jintan 1393 | short_name 1394 | 金坛 1395 | 1396 | 1397 | city_key 1398 | 2100070000 1399 | city_name 1400 | 晋中市 1401 | initials 1402 | jz 1403 | pinyin 1404 | jinzhong 1405 | short_name 1406 | 晋中 1407 | 1408 | 1409 | city_key 1410 | 1300070000 1411 | city_name 1412 | 锦州市 1413 | initials 1414 | jz 1415 | pinyin 1416 | jinzhou 1417 | short_name 1418 | 锦州 1419 | 1420 | 1421 | city_key 1422 | 2400040000 1423 | city_name 1424 | 九江市 1425 | initials 1426 | jj 1427 | pinyin 1428 | jiujiang 1429 | short_name 1430 | 九江 1431 | 1432 | 1433 | city_key 1434 | 1100030000 1435 | city_name 1436 | 鸡西市 1437 | initials 1438 | jx 1439 | pinyin 1440 | jixi 1441 | short_name 1442 | 鸡西 1443 | 1444 | 1445 | city_key 1446 | 2000180000 1447 | city_name 1448 | 济源市 1449 | initials 1450 | jy 1451 | pinyin 1452 | jiyuan 1453 | short_name 1454 | 济源 1455 | 1456 | 1457 | initial 1458 | J 1459 | 1460 | 1461 | citys 1462 | 1463 | 1464 | city_key 1465 | 2000020000 1466 | city_name 1467 | 开封市 1468 | initials 1469 | kf 1470 | pinyin 1471 | kaifeng 1472 | short_name 1473 | 开封 1474 | 1475 | 1476 | city_key 1477 | 2800010000 1478 | city_name 1479 | 昆明市 1480 | initials 1481 | km 1482 | pinyin 1483 | kunming 1484 | short_name 1485 | 昆明 1486 | 1487 | 1488 | city_key 1489 | 700220000 1490 | city_name 1491 | 昆山市 1492 | initials 1493 | ks 1494 | pinyin 1495 | kunshan 1496 | short_name 1497 | 昆山 1498 | 1499 | 1500 | initial 1501 | K 1502 | 1503 | 1504 | citys 1505 | 1506 | 1507 | city_key 1508 | 1400120000 1509 | city_name 1510 | 莱芜市 1511 | initials 1512 | lw 1513 | pinyin 1514 | laiwu 1515 | short_name 1516 | 莱芜 1517 | 1518 | 1519 | city_key 1520 | 1800100000 1521 | city_name 1522 | 廊坊市 1523 | initials 1524 | lf 1525 | pinyin 1526 | langfang 1527 | short_name 1528 | 廊坊 1529 | 1530 | 1531 | city_key 1532 | 600300000 1533 | city_name 1534 | 兰溪市 1535 | initials 1536 | lx 1537 | pinyin 1538 | lanxi 1539 | short_name 1540 | 兰溪 1541 | 1542 | 1543 | city_key 1544 | 3000010000 1545 | city_name 1546 | 兰州市 1547 | initials 1548 | lz 1549 | pinyin 1550 | lanzhou 1551 | short_name 1552 | 兰州 1553 | 1554 | 1555 | city_key 1556 | 600180000 1557 | city_name 1558 | 乐清市 1559 | initials 1560 | lq 1561 | pinyin 1562 | leqing 1563 | short_name 1564 | 乐清 1565 | 1566 | 1567 | city_key 1568 | 800100000 1569 | city_name 1570 | 乐山市 1571 | initials 1572 | ls 1573 | pinyin 1574 | leshan 1575 | short_name 1576 | 乐山 1577 | 1578 | 1579 | city_key 1580 | 700070000 1581 | city_name 1582 | 连云港市 1583 | initials 1584 | lyg 1585 | pinyin 1586 | lianyungang 1587 | short_name 1588 | 连云港 1589 | 1590 | 1591 | city_key 1592 | 1400150000 1593 | city_name 1594 | 聊城市 1595 | initials 1596 | lc 1597 | pinyin 1598 | liaocheng 1599 | short_name 1600 | 聊城 1601 | 1602 | 1603 | city_key 1604 | 1300100000 1605 | city_name 1606 | 辽阳市 1607 | initials 1608 | ly 1609 | pinyin 1610 | liaoyang 1611 | short_name 1612 | 辽阳 1613 | 1614 | 1615 | city_key 1616 | 2300040000 1617 | city_name 1618 | 辽源市 1619 | initials 1620 | ly 1621 | pinyin 1622 | liaoyuan 1623 | short_name 1624 | 辽源 1625 | 1626 | 1627 | city_key 1628 | 2800060000 1629 | city_name 1630 | 丽江市 1631 | initials 1632 | lj 1633 | pinyin 1634 | lijiang 1635 | short_name 1636 | 丽江 1637 | 1638 | 1639 | city_key 1640 | 600360000 1641 | city_name 1642 | 临安市 1643 | initials 1644 | la 1645 | pinyin 1646 | linan 1647 | short_name 1648 | 临安 1649 | 1650 | 1651 | city_key 1652 | 2100100000 1653 | city_name 1654 | 临汾市 1655 | initials 1656 | lf 1657 | pinyin 1658 | linfen 1659 | short_name 1660 | 临汾 1661 | 1662 | 1663 | city_key 1664 | 600220000 1665 | city_name 1666 | 临海市 1667 | initials 1668 | lh 1669 | pinyin 1670 | linhai 1671 | short_name 1672 | 临海 1673 | 1674 | 1675 | city_key 1676 | 1000120000 1677 | city_name 1678 | 临潼市 1679 | initials 1680 | lt 1681 | pinyin 1682 | lintong 1683 | short_name 1684 | 临潼 1685 | 1686 | 1687 | city_key 1688 | 1400130000 1689 | city_name 1690 | 临沂市 1691 | initials 1692 | ly 1693 | pinyin 1694 | linyi 1695 | short_name 1696 | 临沂 1697 | 1698 | 1699 | city_key 1700 | 600020000 1701 | city_name 1702 | 丽水市 1703 | initials 1704 | ls 1705 | pinyin 1706 | lishui 1707 | short_name 1708 | 丽水 1709 | 1710 | 1711 | city_key 1712 | 1500140000 1713 | city_name 1714 | 六安市 1715 | initials 1716 | la 1717 | pinyin 1718 | liuan 1719 | short_name 1720 | 六安 1721 | 1722 | 1723 | city_key 1724 | 2500020000 1725 | city_name 1726 | 柳州市 1727 | initials 1728 | lz 1729 | pinyin 1730 | liuzhou 1731 | short_name 1732 | 柳州 1733 | 1734 | 1735 | city_key 1736 | 700230000 1737 | city_name 1738 | 溧阳市 1739 | initials 1740 | ly 1741 | pinyin 1742 | liyang 1743 | short_name 1744 | 溧阳 1745 | 1746 | 1747 | city_key 1748 | 1400190000 1749 | city_name 1750 | 龙口市 1751 | initials 1752 | lk 1753 | pinyin 1754 | longkou 1755 | short_name 1756 | 龙口 1757 | 1758 | 1759 | city_key 1760 | 1900080000 1761 | city_name 1762 | 龙岩市 1763 | initials 1764 | ly 1765 | pinyin 1766 | longyan 1767 | short_name 1768 | 龙岩 1769 | 1770 | 1771 | city_key 1772 | 2000110000 1773 | city_name 1774 | 漯河市 1775 | initials 1776 | lh 1777 | pinyin 1778 | luohe 1779 | short_name 1780 | 漯河 1781 | 1782 | 1783 | city_key 1784 | 2000030000 1785 | city_name 1786 | 洛阳市 1787 | initials 1788 | ly 1789 | pinyin 1790 | luoyang 1791 | short_name 1792 | 洛阳 1793 | 1794 | 1795 | city_key 1796 | 800040000 1797 | city_name 1798 | 泸州市 1799 | initials 1800 | lz 1801 | pinyin 1802 | luzhou 1803 | short_name 1804 | 泸州 1805 | 1806 | 1807 | city_key 1808 | 2100110000 1809 | city_name 1810 | 吕梁市 1811 | initials 1812 | ll 1813 | pinyin 1814 | lvliang 1815 | short_name 1816 | 吕梁 1817 | 1818 | 1819 | initial 1820 | L 1821 | 1822 | 1823 | citys 1824 | 1825 | 1826 | city_key 1827 | 1500050000 1828 | city_name 1829 | 马鞍山市 1830 | initials 1831 | mas 1832 | pinyin 1833 | maanshan 1834 | short_name 1835 | 马鞍山 1836 | 1837 | 1838 | city_key 1839 | 300090000 1840 | city_name 1841 | 茂名市 1842 | initials 1843 | mm 1844 | pinyin 1845 | maoming 1846 | short_name 1847 | 茂名 1848 | 1849 | 1850 | city_key 1851 | 300120000 1852 | city_name 1853 | 梅州市 1854 | initials 1855 | mz 1856 | pinyin 1857 | meizhou 1858 | short_name 1859 | 梅州 1860 | 1861 | 1862 | city_key 1863 | 800060000 1864 | city_name 1865 | 绵阳市 1866 | initials 1867 | my 1868 | pinyin 1869 | mianyang 1870 | short_name 1871 | 绵阳 1872 | 1873 | 1874 | city_key 1875 | 1500210000 1876 | city_name 1877 | 明光市 1878 | initials 1879 | mg 1880 | pinyin 1881 | mingguang 1882 | short_name 1883 | 明光 1884 | 1885 | 1886 | city_key 1887 | 1100100000 1888 | city_name 1889 | 牡丹江市 1890 | initials 1891 | mdj 1892 | pinyin 1893 | mudanjiang 1894 | short_name 1895 | 牡丹江 1896 | 1897 | 1898 | initial 1899 | M 1900 | 1901 | 1902 | citys 1903 | 1904 | 1905 | city_key 1906 | 2400010000 1907 | city_name 1908 | 南昌市 1909 | initials 1910 | nc 1911 | pinyin 1912 | nanchang 1913 | short_name 1914 | 南昌 1915 | 1916 | 1917 | city_key 1918 | 800110000 1919 | city_name 1920 | 南充市 1921 | initials 1922 | nc 1923 | pinyin 1924 | nanchong 1925 | short_name 1926 | 南充 1927 | 1928 | 1929 | city_key 1930 | 700010000 1931 | city_name 1932 | 南京市 1933 | initials 1934 | nj 1935 | pinyin 1936 | nanjing 1937 | short_name 1938 | 南京 1939 | 1940 | 1941 | city_key 1942 | 2500010000 1943 | city_name 1944 | 南宁市 1945 | initials 1946 | nn 1947 | pinyin 1948 | nanning 1949 | short_name 1950 | 南宁 1951 | 1952 | 1953 | city_key 1954 | 1900070000 1955 | city_name 1956 | 南平市 1957 | initials 1958 | np 1959 | pinyin 1960 | nanping 1961 | short_name 1962 | 南平 1963 | 1964 | 1965 | city_key 1966 | 700060000 1967 | city_name 1968 | 南通市 1969 | initials 1970 | nt 1971 | pinyin 1972 | nantong 1973 | short_name 1974 | 南通 1975 | 1976 | 1977 | city_key 1978 | 2000130000 1979 | city_name 1980 | 南阳市 1981 | initials 1982 | ny 1983 | pinyin 1984 | nanyang 1985 | short_name 1986 | 南阳 1987 | 1988 | 1989 | city_key 1990 | 600110000 1991 | city_name 1992 | 宁波市 1993 | initials 1994 | nb 1995 | pinyin 1996 | ningbo 1997 | short_name 1998 | 宁波 1999 | 2000 | 2001 | city_key 2002 | 1900090000 2003 | city_name 2004 | 宁德市 2005 | initials 2006 | nd 2007 | pinyin 2008 | ningde 2009 | short_name 2010 | 宁德 2011 | 2012 | 2013 | city_key 2014 | 1500220000 2015 | city_name 2016 | 宁国市 2017 | initials 2018 | ng 2019 | pinyin 2020 | ningguo 2021 | short_name 2022 | 宁国 2023 | 2024 | 2025 | initial 2026 | N 2027 | 2028 | 2029 | citys 2030 | 2031 | 2032 | city_key 2033 | 1300110000 2034 | city_name 2035 | 盘锦市 2036 | initials 2037 | pj 2038 | pinyin 2039 | panjin 2040 | short_name 2041 | 盘锦 2042 | 2043 | 2044 | city_key 2045 | 1400250000 2046 | city_name 2047 | 蓬莱市 2048 | initials 2049 | pl 2050 | pinyin 2051 | penglai 2052 | short_name 2053 | 蓬莱 2054 | 2055 | 2056 | city_key 2057 | 2000040000 2058 | city_name 2059 | 平顶山市 2060 | initials 2061 | pds 2062 | pinyin 2063 | pingdingshan 2064 | short_name 2065 | 平顶山 2066 | 2067 | 2068 | city_key 2069 | 600380000 2070 | city_name 2071 | 平湖市 2072 | initials 2073 | ph 2074 | pinyin 2075 | pinghu 2076 | short_name 2077 | 平湖 2078 | 2079 | 2080 | city_key 2081 | 2400030000 2082 | city_name 2083 | 萍乡市 2084 | initials 2085 | px 2086 | pinyin 2087 | pingxiang 2088 | short_name 2089 | 萍乡 2090 | 2091 | 2092 | city_key 2093 | 1900030000 2094 | city_name 2095 | 莆田市 2096 | initials 2097 | pt 2098 | pinyin 2099 | putian 2100 | short_name 2101 | 莆田 2102 | 2103 | 2104 | city_key 2105 | 2000090000 2106 | city_name 2107 | 濮阳市 2108 | initials 2109 | py 2110 | pinyin 2111 | puyang 2112 | short_name 2113 | 濮阳 2114 | 2115 | 2116 | initial 2117 | P 2118 | 2119 | 2120 | citys 2121 | 2122 | 2123 | city_key 2124 | 700320000 2125 | city_name 2126 | 启东县 2127 | initials 2128 | qd 2129 | pinyin 2130 | qidong 2131 | short_name 2132 | 启东 2133 | 2134 | 2135 | city_key 2136 | 1400010000 2137 | city_name 2138 | 青岛市 2139 | initials 2140 | qd 2141 | pinyin 2142 | qingdao 2143 | short_name 2144 | 青岛 2145 | 2146 | 2147 | city_key 2148 | 300160000 2149 | city_name 2150 | 清远市 2151 | initials 2152 | qy 2153 | pinyin 2154 | qingyuan 2155 | short_name 2156 | 清远 2157 | 2158 | 2159 | city_key 2160 | 1400220000 2161 | city_name 2162 | 青州市 2163 | initials 2164 | qz 2165 | pinyin 2166 | qingzhou 2167 | short_name 2168 | 青州 2169 | 2170 | 2171 | city_key 2172 | 1800030000 2173 | city_name 2174 | 秦皇岛市 2175 | initials 2176 | qhd 2177 | pinyin 2178 | qinhuangdao 2179 | short_name 2180 | 秦皇岛 2181 | 2182 | 2183 | city_key 2184 | 2600040000 2185 | city_name 2186 | 琼海市 2187 | initials 2188 | qh 2189 | pinyin 2190 | qionghai 2191 | short_name 2192 | 琼海 2193 | 2194 | 2195 | city_key 2196 | 1100020000 2197 | city_name 2198 | 齐齐哈尔市 2199 | initials 2200 | qqhe 2201 | pinyin 2202 | qiqihar 2203 | short_name 2204 | 齐齐哈尔 2205 | 2206 | 2207 | city_key 2208 | 2100090000 2209 | city_name 2210 | 忻州市 2211 | initials 2212 | xz 2213 | pinyin 2214 | qizhou 2215 | short_name 2216 | 忻州 2217 | 2218 | 2219 | city_key 2220 | 1900050000 2221 | city_name 2222 | 泉州市 2223 | initials 2224 | qz 2225 | pinyin 2226 | quanzhou 2227 | short_name 2228 | 泉州 2229 | 2230 | 2231 | city_key 2232 | 2800020000 2233 | city_name 2234 | 曲靖市 2235 | initials 2236 | qj 2237 | pinyin 2238 | qujing 2239 | short_name 2240 | 曲靖 2241 | 2242 | 2243 | city_key 2244 | 600080000 2245 | city_name 2246 | 衢州市 2247 | initials 2248 | qz 2249 | pinyin 2250 | quzhou 2251 | short_name 2252 | 衢州 2253 | 2254 | 2255 | initial 2256 | Q 2257 | 2258 | 2259 | citys 2260 | 2261 | 2262 | city_key 2263 | 1400110000 2264 | city_name 2265 | 日照市 2266 | initials 2267 | rz 2268 | pinyin 2269 | rizhao 2270 | short_name 2271 | 日照 2272 | 2273 | 2274 | city_key 2275 | 700300000 2276 | city_name 2277 | 如皋县 2278 | initials 2279 | rg 2280 | pinyin 2281 | rugao 2282 | short_name 2283 | 如皋 2284 | 2285 | 2286 | city_key 2287 | 600170000 2288 | city_name 2289 | 瑞安市 2290 | initials 2291 | ra 2292 | pinyin 2293 | ruian 2294 | short_name 2295 | 瑞安 2296 | 2297 | 2298 | initial 2299 | R 2300 | 2301 | 2302 | citys 2303 | 2304 | 2305 | city_key 2306 | 2000120000 2307 | city_name 2308 | 三门峡市 2309 | initials 2310 | smx 2311 | pinyin 2312 | sanmenxia 2313 | short_name 2314 | 三门峡 2315 | 2316 | 2317 | city_key 2318 | 1900040000 2319 | city_name 2320 | 三明市 2321 | initials 2322 | sm 2323 | pinyin 2324 | sanming 2325 | short_name 2326 | 三明 2327 | 2328 | 2329 | city_key 2330 | 2600020000 2331 | city_name 2332 | 三亚市 2333 | initials 2334 | sy 2335 | pinyin 2336 | sanya 2337 | short_name 2338 | 三亚 2339 | 2340 | 2341 | city_key 2342 | 200010000 2343 | city_name 2344 | 上海市 2345 | initials 2346 | sh 2347 | pinyin 2348 | shanghai 2349 | short_name 2350 | 上海 2351 | 2352 | 2353 | city_key 2354 | 1000100000 2355 | city_name 2356 | 商洛市 2357 | initials 2358 | sl 2359 | pinyin 2360 | shangluo 2361 | short_name 2362 | 商洛 2363 | 2364 | 2365 | city_key 2366 | 2000140000 2367 | city_name 2368 | 商丘市 2369 | initials 2370 | sq 2371 | pinyin 2372 | shangqiu 2373 | short_name 2374 | 商丘 2375 | 2376 | 2377 | city_key 2378 | 2400110000 2379 | city_name 2380 | 上饶市 2381 | initials 2382 | sr 2383 | pinyin 2384 | shangrao 2385 | short_name 2386 | 上饶 2387 | 2388 | 2389 | city_key 2390 | 600200000 2391 | city_name 2392 | 上虞市 2393 | initials 2394 | sy 2395 | pinyin 2396 | shangyu 2397 | short_name 2398 | 上虞 2399 | 2400 | 2401 | city_key 2402 | 300050000 2403 | city_name 2404 | 汕头市 2405 | initials 2406 | st 2407 | pinyin 2408 | shantou 2409 | short_name 2410 | 汕头 2411 | 2412 | 2413 | city_key 2414 | 300130000 2415 | city_name 2416 | 汕尾市 2417 | initials 2418 | sw 2419 | pinyin 2420 | shanwei 2421 | short_name 2422 | 汕尾 2423 | 2424 | 2425 | city_key 2426 | 300020000 2427 | city_name 2428 | 韶关市 2429 | initials 2430 | sg 2431 | pinyin 2432 | shaoguan 2433 | short_name 2434 | 韶关 2435 | 2436 | 2437 | city_key 2438 | 600060000 2439 | city_name 2440 | 绍兴市 2441 | initials 2442 | sx 2443 | pinyin 2444 | shaoxing 2445 | short_name 2446 | 绍兴 2447 | 2448 | 2449 | city_key 2450 | 1300020000 2451 | city_name 2452 | 沈阳市 2453 | initials 2454 | sy 2455 | pinyin 2456 | shenyang 2457 | short_name 2458 | 沈阳 2459 | 2460 | 2461 | city_key 2462 | 300210000 2463 | city_name 2464 | 深圳市 2465 | initials 2466 | sz 2467 | pinyin 2468 | shenzhen 2469 | short_name 2470 | 深圳 2471 | 2472 | 2473 | city_key 2474 | 1800010000 2475 | city_name 2476 | 石家庄市 2477 | initials 2478 | sjz 2479 | pinyin 2480 | shijiazhuang 2481 | short_name 2482 | 石家庄 2483 | 2484 | 2485 | city_key 2486 | 1900110000 2487 | city_name 2488 | 石狮市 2489 | initials 2490 | ss 2491 | pinyin 2492 | shishi 2493 | short_name 2494 | 石狮 2495 | 2496 | 2497 | city_key 2498 | 400030000 2499 | city_name 2500 | 十堰市 2501 | initials 2502 | sy 2503 | pinyin 2504 | shiyan 2505 | short_name 2506 | 十堰 2507 | 2508 | 2509 | city_key 2510 | 1400230000 2511 | city_name 2512 | 寿光市 2513 | initials 2514 | sg 2515 | pinyin 2516 | shouguang 2517 | short_name 2518 | 寿光 2519 | 2520 | 2521 | city_key 2522 | 1100050000 2523 | city_name 2524 | 双鸭山市 2525 | initials 2526 | sys 2527 | pinyin 2528 | shuangyashan 2529 | short_name 2530 | 双鸭山 2531 | 2532 | 2533 | city_key 2534 | 300220000 2535 | city_name 2536 | 顺德区 2537 | initials 2538 | sd 2539 | pinyin 2540 | shunde 2541 | short_name 2542 | 顺德 2543 | 2544 | 2545 | city_key 2546 | 2100060000 2547 | city_name 2548 | 朔州市 2549 | initials 2550 | sz 2551 | pinyin 2552 | shuozhou 2553 | short_name 2554 | 朔州 2555 | 2556 | 2557 | city_key 2558 | 2300030000 2559 | city_name 2560 | 四平市 2561 | initials 2562 | sp 2563 | pinyin 2564 | siping 2565 | short_name 2566 | 四平 2567 | 2568 | 2569 | city_key 2570 | 2300070000 2571 | city_name 2572 | 松原市 2573 | initials 2574 | sy 2575 | pinyin 2576 | songyuan 2577 | short_name 2578 | 松原 2579 | 2580 | 2581 | city_key 2582 | 1100120000 2583 | city_name 2584 | 绥化市 2585 | initials 2586 | sh 2587 | pinyin 2588 | suihua 2589 | short_name 2590 | 绥化 2591 | 2592 | 2593 | city_key 2594 | 700130000 2595 | city_name 2596 | 宿迁市 2597 | initials 2598 | sq 2599 | pinyin 2600 | suqian 2601 | short_name 2602 | 宿迁 2603 | 2604 | 2605 | city_key 2606 | 700110000 2607 | city_name 2608 | 苏州市 2609 | initials 2610 | sz 2611 | pinyin 2612 | suzhou 2613 | short_name 2614 | 苏州 2615 | 2616 | 2617 | initial 2618 | S 2619 | 2620 | 2621 | citys 2622 | 2623 | 2624 | city_key 2625 | 1400090000 2626 | city_name 2627 | 泰安市 2628 | initials 2629 | ta 2630 | pinyin 2631 | taian 2632 | short_name 2633 | 泰安 2634 | 2635 | 2636 | city_key 2637 | 700290000 2638 | city_name 2639 | 太仓市 2640 | initials 2641 | tc 2642 | pinyin 2643 | taicang 2644 | short_name 2645 | 太仓 2646 | 2647 | 2648 | city_key 2649 | 2100010000 2650 | city_name 2651 | 太原市 2652 | initials 2653 | ty 2654 | pinyin 2655 | taiyuan 2656 | short_name 2657 | 太原 2658 | 2659 | 2660 | city_key 2661 | 600100000 2662 | city_name 2663 | 台州市 2664 | initials 2665 | tz 2666 | pinyin 2667 | taizhou 2668 | short_name 2669 | 台州 2670 | 2671 | 2672 | city_key 2673 | 700120000 2674 | city_name 2675 | 泰州市 2676 | initials 2677 | tz 2678 | pinyin 2679 | taizhoux 2680 | short_name 2681 | 泰州 2682 | 2683 | 2684 | city_key 2685 | 1800020000 2686 | city_name 2687 | 唐山市 2688 | initials 2689 | ts 2690 | pinyin 2691 | tangshan 2692 | short_name 2693 | 唐山 2694 | 2695 | 2696 | city_key 2697 | 1500200000 2698 | city_name 2699 | 天长市 2700 | initials 2701 | tz 2702 | pinyin 2703 | tianchang 2704 | short_name 2705 | 天长 2706 | 2707 | 2708 | city_key 2709 | 500010000 2710 | city_name 2711 | 天津市 2712 | initials 2713 | tj 2714 | pinyin 2715 | tianjin 2716 | short_name 2717 | 天津 2718 | 2719 | 2720 | city_key 2721 | 3000050000 2722 | city_name 2723 | 天水市 2724 | initials 2725 | ts 2726 | pinyin 2727 | tianshui 2728 | short_name 2729 | 天水 2730 | 2731 | 2732 | city_key 2733 | 1300120000 2734 | city_name 2735 | 铁岭市 2736 | initials 2737 | tl 2738 | pinyin 2739 | tieling 2740 | short_name 2741 | 铁岭 2742 | 2743 | 2744 | city_key 2745 | 1500180000 2746 | city_name 2747 | 桐城市 2748 | initials 2749 | tc 2750 | pinyin 2751 | tongcheng 2752 | short_name 2753 | 桐城 2754 | 2755 | 2756 | city_key 2757 | 2300050000 2758 | city_name 2759 | 通化市 2760 | initials 2761 | th 2762 | pinyin 2763 | tonghua 2764 | short_name 2765 | 通化 2766 | 2767 | 2768 | city_key 2769 | 1500070000 2770 | city_name 2771 | 铜陵市 2772 | initials 2773 | tl 2774 | pinyin 2775 | tongling 2776 | short_name 2777 | 铜陵 2778 | 2779 | 2780 | city_key 2781 | 600320000 2782 | city_name 2783 | 桐庐县 2784 | initials 2785 | tl 2786 | pinyin 2787 | tonglu 2788 | short_name 2789 | 桐庐 2790 | 2791 | 2792 | city_key 2793 | 600250000 2794 | city_name 2795 | 桐乡市 2796 | initials 2797 | tx 2798 | pinyin 2799 | tongxiang 2800 | short_name 2801 | 桐乡 2802 | 2803 | 2804 | initial 2805 | T 2806 | 2807 | 2808 | citys 2809 | 2810 | 2811 | city_key 2812 | 1400070000 2813 | city_name 2814 | 潍坊市 2815 | initials 2816 | wf 2817 | pinyin 2818 | weifang 2819 | short_name 2820 | 潍坊 2821 | 2822 | 2823 | city_key 2824 | 1400100000 2825 | city_name 2826 | 威海市 2827 | initials 2828 | wh 2829 | pinyin 2830 | weihai 2831 | short_name 2832 | 威海 2833 | 2834 | 2835 | city_key 2836 | 1000050000 2837 | city_name 2838 | 渭南市 2839 | initials 2840 | wn 2841 | pinyin 2842 | weinan 2843 | short_name 2844 | 渭南 2845 | 2846 | 2847 | city_key 2848 | 600230000 2849 | city_name 2850 | 温岭市 2851 | initials 2852 | wl 2853 | pinyin 2854 | wenling 2855 | short_name 2856 | 温岭 2857 | 2858 | 2859 | city_key 2860 | 600030000 2861 | city_name 2862 | 温州市 2863 | initials 2864 | wz 2865 | pinyin 2866 | wenzhou 2867 | short_name 2868 | 温州 2869 | 2870 | 2871 | city_key 2872 | 400010000 2873 | city_name 2874 | 武汉市 2875 | initials 2876 | wh 2877 | pinyin 2878 | wuhan 2879 | short_name 2880 | 武汉 2881 | 2882 | 2883 | city_key 2884 | 1500020000 2885 | city_name 2886 | 芜湖市 2887 | initials 2888 | wh 2889 | pinyin 2890 | wuhu 2891 | short_name 2892 | 芜湖 2893 | 2894 | 2895 | city_key 2896 | 3300010000 2897 | city_name 2898 | 乌鲁木齐市 2899 | initials 2900 | wlmq 2901 | pinyin 2902 | wulumuqi 2903 | short_name 2904 | 乌鲁木齐 2905 | 2906 | 2907 | city_key 2908 | 700210000 2909 | city_name 2910 | 无锡市 2911 | initials 2912 | wx 2913 | pinyin 2914 | wuxi 2915 | short_name 2916 | 无锡 2917 | 2918 | 2919 | city_key 2920 | 1900120000 2921 | city_name 2922 | 武夷山 2923 | initials 2924 | wys 2925 | pinyin 2926 | wuyishan 2927 | short_name 2928 | 武夷山 2929 | 2930 | 2931 | initial 2932 | W 2933 | 2934 | 2935 | citys 2936 | 2937 | 2938 | city_key 2939 | 1900020000 2940 | city_name 2941 | 厦门市 2942 | initials 2943 | sm 2944 | pinyin 2945 | xiamen 2946 | short_name 2947 | 厦门 2948 | 2949 | 2950 | city_key 2951 | 1000010000 2952 | city_name 2953 | 西安市 2954 | initials 2955 | xa 2956 | pinyin 2957 | xian 2958 | short_name 2959 | 西安 2960 | 2961 | 2962 | city_key 2963 | 1200030000 2964 | city_name 2965 | 湘潭市 2966 | initials 2967 | xt 2968 | pinyin 2969 | xiangtan 2970 | short_name 2971 | 湘潭 2972 | 2973 | 2974 | city_key 2975 | 400130000 2976 | city_name 2977 | 襄阳市 2978 | initials 2979 | xy 2980 | pinyin 2981 | xiangyang 2982 | short_name 2983 | 襄阳 2984 | 2985 | 2986 | city_key 2987 | 400140000 2988 | city_name 2989 | 咸宁市 2990 | initials 2991 | xn 2992 | pinyin 2993 | xianning 2994 | short_name 2995 | 咸宁 2996 | 2997 | 2998 | city_key 2999 | 1000040000 3000 | city_name 3001 | 咸阳市 3002 | initials 3003 | xy 3004 | pinyin 3005 | xianyang 3006 | short_name 3007 | 咸阳 3008 | 3009 | 3010 | city_key 3011 | 400080000 3012 | city_name 3013 | 孝感市 3014 | initials 3015 | xg 3016 | pinyin 3017 | xiaogan 3018 | short_name 3019 | 孝感 3020 | 3021 | 3022 | city_key 3023 | 600390000 3024 | city_name 3025 | 萧山市 3026 | initials 3027 | xs 3028 | pinyin 3029 | xiaoshan 3030 | short_name 3031 | 萧山 3032 | 3033 | 3034 | city_key 3035 | 1800050000 3036 | city_name 3037 | 邢台市 3038 | initials 3039 | xt 3040 | pinyin 3041 | xingtai 3042 | short_name 3043 | 邢台 3044 | 3045 | 3046 | city_key 3047 | 2000230000 3048 | city_name 3049 | 荥阳市 3050 | initials 3051 | xy 3052 | pinyin 3053 | xingyang 3054 | short_name 3055 | 荥阳 3056 | 3057 | 3058 | city_key 3059 | 2000220000 3060 | city_name 3061 | 新密市 3062 | initials 3063 | xm 3064 | pinyin 3065 | xinmi 3066 | short_name 3067 | 新密 3068 | 3069 | 3070 | city_key 3071 | 2000070000 3072 | city_name 3073 | 新乡市 3074 | initials 3075 | xx 3076 | pinyin 3077 | xinxiang 3078 | short_name 3079 | 新乡 3080 | 3081 | 3082 | city_key 3083 | 2000150000 3084 | city_name 3085 | 信阳市 3086 | initials 3087 | xy 3088 | pinyin 3089 | xinyang 3090 | short_name 3091 | 信阳 3092 | 3093 | 3094 | city_key 3095 | 2000210000 3096 | city_name 3097 | 新郑市 3098 | initials 3099 | xz 3100 | pinyin 3101 | xinzheng 3102 | short_name 3103 | 新郑 3104 | 3105 | 3106 | city_key 3107 | 2800120000 3108 | city_name 3109 | 西双版纳傣族自治州 3110 | initials 3111 | xsbndz 3112 | pinyin 3113 | xishuangbanna 3114 | short_name 3115 | 西双版纳傣族 3116 | 3117 | 3118 | city_key 3119 | 1500170000 3120 | city_name 3121 | 宣城市 3122 | initials 3123 | xc 3124 | pinyin 3125 | xuancheng 3126 | short_name 3127 | 宣城 3128 | 3129 | 3130 | city_key 3131 | 2000100000 3132 | city_name 3133 | 许昌市 3134 | initials 3135 | xc 3136 | pinyin 3137 | xuchang 3138 | short_name 3139 | 许昌 3140 | 3141 | 3142 | city_key 3143 | 700030000 3144 | city_name 3145 | 徐州市 3146 | initials 3147 | xz 3148 | pinyin 3149 | xuzhou 3150 | short_name 3151 | 徐州 3152 | 3153 | 3154 | initial 3155 | X 3156 | 3157 | 3158 | citys 3159 | 3160 | 3161 | city_key 3162 | 1000060000 3163 | city_name 3164 | 延安市 3165 | initials 3166 | ya 3167 | pinyin 3168 | yanan 3169 | short_name 3170 | 延安 3171 | 3172 | 3173 | city_key 3174 | 2300090000 3175 | city_name 3176 | 延边朝鲜族自治州 3177 | initials 3178 | ybcxz 3179 | pinyin 3180 | yanbian 3181 | short_name 3182 | 延边朝鲜族 3183 | 3184 | 3185 | city_key 3186 | 700090000 3187 | city_name 3188 | 盐城市 3189 | initials 3190 | yc 3191 | pinyin 3192 | yancheng 3193 | short_name 3194 | 盐城 3195 | 3196 | 3197 | city_key 3198 | 300150000 3199 | city_name 3200 | 阳江市 3201 | initials 3202 | yj 3203 | pinyin 3204 | yangjiang 3205 | short_name 3206 | 阳江 3207 | 3208 | 3209 | city_key 3210 | 2100030000 3211 | city_name 3212 | 阳泉市 3213 | initials 3214 | yq 3215 | pinyin 3216 | yangquan 3217 | short_name 3218 | 阳泉 3219 | 3220 | 3221 | city_key 3222 | 2500160000 3223 | city_name 3224 | 阳朔市 3225 | initials 3226 | ys 3227 | pinyin 3228 | yangshuo 3229 | short_name 3230 | 阳朔 3231 | 3232 | 3233 | city_key 3234 | 700100000 3235 | city_name 3236 | 扬州市 3237 | initials 3238 | yz 3239 | pinyin 3240 | yangzhou 3241 | short_name 3242 | 扬州 3243 | 3244 | 3245 | city_key 3246 | 2300020001 3247 | city_name 3248 | 延吉市 3249 | initials 3250 | yj 3251 | pinyin 3252 | yanji 3253 | short_name 3254 | 延吉 3255 | 3256 | 3257 | city_key 3258 | 1000110000 3259 | city_name 3260 | 阎良市 3261 | initials 3262 | yl 3263 | pinyin 3264 | yanliang 3265 | short_name 3266 | 阎良 3267 | 3268 | 3269 | city_key 3270 | 1400060000 3271 | city_name 3272 | 烟台市 3273 | initials 3274 | yt 3275 | pinyin 3276 | yantai 3277 | short_name 3278 | 烟台 3279 | 3280 | 3281 | city_key 3282 | 1400200000 3283 | city_name 3284 | 兖州市 3285 | initials 3286 | yz 3287 | pinyin 3288 | yanzhou 3289 | short_name 3290 | 兖州 3291 | 3292 | 3293 | city_key 3294 | 800130000 3295 | city_name 3296 | 宜宾市 3297 | initials 3298 | yb 3299 | pinyin 3300 | yibin 3301 | short_name 3302 | 宜宾 3303 | 3304 | 3305 | city_key 3306 | 400040000 3307 | city_name 3308 | 宜昌市 3309 | initials 3310 | yc 3311 | pinyin 3312 | yichang 3313 | short_name 3314 | 宜昌 3315 | 3316 | 3317 | city_key 3318 | 1100070000 3319 | city_name 3320 | 伊春市 3321 | initials 3322 | yc 3323 | pinyin 3324 | yichun 3325 | short_name 3326 | 伊春 3327 | 3328 | 3329 | city_key 3330 | 3200010000 3331 | city_name 3332 | 银川市 3333 | initials 3334 | yc 3335 | pinyin 3336 | yinchuan 3337 | short_name 3338 | 银川 3339 | 3340 | 3341 | city_key 3342 | 1300080000 3343 | city_name 3344 | 营口市 3345 | initials 3346 | yk 3347 | pinyin 3348 | yingkou 3349 | short_name 3350 | 营口 3351 | 3352 | 3353 | city_key 3354 | 600130000 3355 | city_name 3356 | 义乌市 3357 | initials 3358 | yw 3359 | pinyin 3360 | yiwu 3361 | short_name 3362 | 义乌 3363 | 3364 | 3365 | city_key 3366 | 700270000 3367 | city_name 3368 | 宜兴市 3369 | initials 3370 | yx 3371 | pinyin 3372 | yixing 3373 | short_name 3374 | 宜兴 3375 | 3376 | 3377 | city_key 3378 | 700240000 3379 | city_name 3380 | 仪征市 3381 | initials 3382 | yz 3383 | pinyin 3384 | yizheng 3385 | short_name 3386 | 仪征 3387 | 3388 | 3389 | city_key 3390 | 600290000 3391 | city_name 3392 | 永康市 3393 | initials 3394 | yk 3395 | pinyin 3396 | yongkang 3397 | short_name 3398 | 永康 3399 | 3400 | 3401 | city_key 3402 | 1200060000 3403 | city_name 3404 | 岳阳市 3405 | initials 3406 | yy 3407 | pinyin 3408 | yueyang 3409 | short_name 3410 | 岳阳 3411 | 3412 | 3413 | city_key 3414 | 600350000 3415 | city_name 3416 | 余杭市 3417 | initials 3418 | yh 3419 | pinyin 3420 | yuhang 3421 | short_name 3422 | 余杭 3423 | 3424 | 3425 | city_key 3426 | 1000080000 3427 | city_name 3428 | 榆林市 3429 | initials 3430 | yl 3431 | pinyin 3432 | yulin 3433 | short_name 3434 | 榆林 3435 | 3436 | 3437 | city_key 3438 | 2500090000 3439 | city_name 3440 | 玉林市 3441 | initials 3442 | yl 3443 | pinyin 3444 | yulin1 3445 | short_name 3446 | 玉林 3447 | 3448 | 3449 | city_key 3450 | 2100080000 3451 | city_name 3452 | 运城市 3453 | initials 3454 | yc 3455 | pinyin 3456 | yuncheng 3457 | short_name 3458 | 运城 3459 | 3460 | 3461 | city_key 3462 | 300030000 3463 | city_name 3464 | 云浮市 3465 | initials 3466 | yf 3467 | pinyin 3468 | yunfu 3469 | short_name 3470 | 云浮 3471 | 3472 | 3473 | city_key 3474 | 2800030000 3475 | city_name 3476 | 玉溪市 3477 | initials 3478 | yx 3479 | pinyin 3480 | yuxi 3481 | short_name 3482 | 玉溪 3483 | 3484 | 3485 | city_key 3486 | 600190000 3487 | city_name 3488 | 余姚市 3489 | initials 3490 | yy 3491 | pinyin 3492 | yuyao 3493 | short_name 3494 | 余姚 3495 | 3496 | 3497 | initial 3498 | Y 3499 | 3500 | 3501 | initial 3502 | Z 3503 | citys 3504 | 3505 | 3506 | city_key 3507 | 700280000 3508 | city_name 3509 | 张家港市 3510 | initials 3511 | zjg 3512 | pinyin 3513 | zhangjiagang 3514 | short_name 3515 | 张家港 3516 | 3517 | 3518 | city_key 3519 | 1800070000 3520 | city_name 3521 | 张家口市 3522 | initials 3523 | zjk 3524 | pinyin 3525 | zhangjiakou 3526 | short_name 3527 | 张家口 3528 | 3529 | 3530 | city_key 3531 | 1400240000 3532 | city_name 3533 | 章丘市 3534 | initials 3535 | zq 3536 | pinyin 3537 | zhangqiu 3538 | short_name 3539 | 章丘 3540 | 3541 | 3542 | city_key 3543 | 1900060000 3544 | city_name 3545 | 漳州市 3546 | initials 3547 | zz 3548 | pinyin 3549 | zhangzhou 3550 | short_name 3551 | 漳州 3552 | 3553 | 3554 | city_key 3555 | 300080000 3556 | city_name 3557 | 湛江市 3558 | initials 3559 | zj 3560 | pinyin 3561 | zhanjiang 3562 | short_name 3563 | 湛江 3564 | 3565 | 3566 | city_key 3567 | 300100000 3568 | city_name 3569 | 肇庆市 3570 | initials 3571 | zq 3572 | pinyin 3573 | zhaoqing 3574 | short_name 3575 | 肇庆 3576 | 3577 | 3578 | city_key 3579 | 1400270000 3580 | city_name 3581 | 招远市 3582 | initials 3583 | zy 3584 | pinyin 3585 | zhaoyuan 3586 | short_name 3587 | 招远 3588 | 3589 | 3590 | city_key 3591 | 2000010000 3592 | city_name 3593 | 郑州市 3594 | initials 3595 | zz 3596 | pinyin 3597 | zhengzhou 3598 | short_name 3599 | 郑州 3600 | 3601 | 3602 | city_key 3603 | 700050000 3604 | city_name 3605 | 镇江市 3606 | initials 3607 | zj 3608 | pinyin 3609 | zhenjiang 3610 | short_name 3611 | 镇江 3612 | 3613 | 3614 | city_key 3615 | 300180000 3616 | city_name 3617 | 中山市 3618 | initials 3619 | zs 3620 | pinyin 3621 | zhongshan 3622 | short_name 3623 | 中山 3624 | 3625 | 3626 | city_key 3627 | 2000160000 3628 | city_name 3629 | 周口市 3630 | initials 3631 | zk 3632 | pinyin 3633 | zhoukou 3634 | short_name 3635 | 周口 3636 | 3637 | 3638 | city_key 3639 | 600090000 3640 | city_name 3641 | 舟山市 3642 | initials 3643 | zs 3644 | pinyin 3645 | zhoushan 3646 | short_name 3647 | 舟山 3648 | 3649 | 3650 | city_key 3651 | 300040000 3652 | city_name 3653 | 珠海市 3654 | initials 3655 | zh 3656 | pinyin 3657 | zhuhai 3658 | short_name 3659 | 珠海 3660 | 3661 | 3662 | city_key 3663 | 600210000 3664 | city_name 3665 | 诸暨市 3666 | initials 3667 | zj 3668 | pinyin 3669 | zhuji 3670 | short_name 3671 | 诸暨 3672 | 3673 | 3674 | city_key 3675 | 2000170000 3676 | city_name 3677 | 驻马店市 3678 | initials 3679 | zmd 3680 | pinyin 3681 | zhumadian 3682 | short_name 3683 | 驻马店 3684 | 3685 | 3686 | city_key 3687 | 1200020000 3688 | city_name 3689 | 株洲市 3690 | initials 3691 | zz 3692 | pinyin 3693 | zhuzhou 3694 | short_name 3695 | 株洲 3696 | 3697 | 3698 | city_key 3699 | 1400030000 3700 | city_name 3701 | 淄博市 3702 | initials 3703 | zb 3704 | pinyin 3705 | zibo 3706 | short_name 3707 | 淄博 3708 | 3709 | 3710 | city_key 3711 | 800020000 3712 | city_name 3713 | 自贡市 3714 | initials 3715 | zg 3716 | pinyin 3717 | zigong 3718 | short_name 3719 | 自贡 3720 | 3721 | 3722 | city_key 3723 | 2700030000 3724 | city_name 3725 | 遵义市 3726 | initials 3727 | zy 3728 | pinyin 3729 | zunyi 3730 | short_name 3731 | 遵义 3732 | 3733 | 3734 | 3735 | 3736 | 3737 | -------------------------------------------------------------------------------- /TLCityPicker/TLCity.h: -------------------------------------------------------------------------------- 1 | // 2 | // TLCity.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #pragma mark - TLCity 12 | @interface TLCity : NSObject 13 | 14 | /* 15 | * 城市ID 16 | */ 17 | @property (nonatomic, strong) NSString *cityID; 18 | 19 | /* 20 | * 城市名称 21 | */ 22 | @property (nonatomic, strong) NSString *cityName; 23 | 24 | /* 25 | * 短名称 26 | */ 27 | @property (nonatomic, strong) NSString *shortName; 28 | 29 | /* 30 | * 城市名称-拼音 31 | */ 32 | @property (nonatomic, strong) NSString *pinyin; 33 | 34 | /* 35 | * 城市名称-拼音首字母 36 | */ 37 | @property (nonatomic, strong) NSString *initials; 38 | 39 | @end 40 | 41 | 42 | #pragma mark - TLCityGroup 43 | @interface TLCityGroup : NSObject 44 | 45 | /* 46 | * 分组标题 47 | */ 48 | @property (nonatomic, strong) NSString *groupName; 49 | 50 | /* 51 | * 城市数组 52 | */ 53 | @property (nonatomic, strong) NSMutableArray *arrayCitys; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /TLCityPicker/TLCity.m: -------------------------------------------------------------------------------- 1 | // 2 | // TLCity.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "TLCity.h" 10 | 11 | @implementation TLCity 12 | 13 | @end 14 | 15 | #pragma mark - TLCityGroup 16 | @implementation TLCityGroup 17 | 18 | - (NSMutableArray *) arrayCitys 19 | { 20 | if (_arrayCitys == nil) { 21 | _arrayCitys = [[NSMutableArray alloc] init]; 22 | } 23 | return _arrayCitys; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityGroupCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityGroupCell.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "TLCity.h" 11 | #import "TLCityPickerDelegate.h" 12 | 13 | @interface TLCityGroupCell : UITableViewCell 14 | 15 | @property (nonatomic, assign) iddelegate; 16 | 17 | @property (nonatomic, strong) NSString *title; 18 | 19 | @property (nonatomic, strong) NSArray *cityArray; 20 | 21 | + (CGFloat) getCellHeightOfCityArray:(NSArray *)cityArray; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityGroupCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityGroupCell.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "TLCityGroupCell.h" 10 | 11 | #define MIN_SPACE 8 // 城市button最小间隙 12 | #define MAX_SPACE 10 13 | 14 | #define WIDTH_LEFT 13.5 // button左边距 15 | #define WIDTH_RIGHT 28 // button右边距 16 | 17 | #define MIN_WIDTH_BUTTON 75 18 | #define HEIGHT_BUTTON 38 19 | 20 | @interface TLCityGroupCell () 21 | 22 | @property (nonatomic, strong) UILabel *titleLabel; 23 | @property (nonatomic, strong) UILabel *noDataLabel; 24 | 25 | @property (nonatomic, strong) NSMutableArray *arrayCityButtons; 26 | 27 | @end 28 | 29 | @implementation TLCityGroupCell 30 | 31 | - (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 32 | { 33 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 34 | [self setBackgroundColor:[UIColor colorWithWhite:0.95 alpha:1.0]]; 35 | [self setSelectionStyle:UITableViewCellSelectionStyleNone]; 36 | [self addSubview:self.titleLabel]; 37 | [self addSubview:self.noDataLabel]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void) layoutSubviews 43 | { 44 | [super layoutSubviews]; 45 | float x = WIDTH_LEFT; 46 | float y = 5; 47 | CGSize size = [self.titleLabel sizeThatFits:CGSizeMake(MAXFLOAT, MAXFLOAT)]; 48 | [self.titleLabel setFrame:CGRectMake(x, y, self.frame.size.width - x, size.height)]; 49 | y += size.height + 3; 50 | [self.noDataLabel setFrame:CGRectMake(x + 5, y, self.frame.size.width - x - 5, self.titleLabel.frame.size.height)]; 51 | 52 | y += 7; 53 | float space = MIN_SPACE; // 最小空隙 54 | float width = MIN_WIDTH_BUTTON; // button最小宽度 55 | int t = (self.frame.size.width - WIDTH_LEFT - WIDTH_RIGHT + space) / (width + space); 56 | 57 | space = (self.frame.size.width - WIDTH_LEFT - WIDTH_RIGHT - width * t) / (t - 1); // 修正空隙宽度 58 | if (space > MAX_SPACE) { // 修正button宽度 59 | width += (space - MAX_SPACE) * (t - 1) / t; 60 | space = MAX_SPACE; 61 | } 62 | 63 | for (int i = 0; i < self.arrayCityButtons.count; i ++) { 64 | UIButton *button = [self.arrayCityButtons objectAtIndex:i]; 65 | [button setFrame:CGRectMake(x, y, width, HEIGHT_BUTTON)]; 66 | if ((i + 1) % t == 0) { 67 | y += HEIGHT_BUTTON + 5; 68 | x = WIDTH_LEFT; 69 | } 70 | else { 71 | x += width + space; 72 | } 73 | } 74 | } 75 | 76 | + (CGFloat) getCellHeightOfCityArray:(NSArray *)cityArray 77 | { 78 | float h = 30; 79 | if (cityArray != nil && cityArray.count > 0) { 80 | float space = MIN_SPACE; // 最小空隙 81 | float width = MIN_WIDTH_BUTTON; // button最小宽度 82 | int t = ([UIScreen mainScreen].bounds.size.width - WIDTH_LEFT - WIDTH_RIGHT + space) / (width + space); 83 | 84 | space = ([UIScreen mainScreen].bounds.size.width - WIDTH_LEFT - WIDTH_RIGHT - width * t) / (t - 1); // 修正空隙宽度 85 | if (space > MAX_SPACE) { // 修正button宽度 86 | width += (space - MAX_SPACE) * (t - 1) / t; 87 | space = MAX_SPACE; 88 | } 89 | 90 | h += (10 + (HEIGHT_BUTTON + 5) * (cityArray.count / t + (cityArray.count % t == 0 ? 0 : 1))); 91 | } 92 | else { 93 | h += 17; 94 | } 95 | return h; 96 | } 97 | 98 | #pragma mark - Setter 99 | - (void) setTitle:(NSString *)title 100 | { 101 | _title = title; 102 | [_titleLabel setText:title]; 103 | } 104 | 105 | - (void) setCityArray:(NSArray *)cityArray 106 | { 107 | _cityArray = cityArray; 108 | [self.noDataLabel setHidden:(cityArray != nil && cityArray.count > 0)]; 109 | 110 | for (int i = 0; i < cityArray.count; i ++) { 111 | TLCity *city = [cityArray objectAtIndex:i]; 112 | UIButton *button = nil; 113 | if (i < self.arrayCityButtons.count) { 114 | button = [self.arrayCityButtons objectAtIndex:i]; 115 | } 116 | else { 117 | button = [[UIButton alloc] init]; 118 | [button setBackgroundColor:[UIColor whiteColor]]; 119 | [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; 120 | [button.titleLabel setFont:[UIFont systemFontOfSize:14.0f]]; 121 | [button.layer setMasksToBounds:YES]; 122 | [button.layer setCornerRadius:2.0f]; 123 | [button.layer setBorderColor:[UIColor colorWithWhite:0.8 alpha:1.0].CGColor]; 124 | [button.layer setBorderWidth:1.0f]; 125 | [button addTarget:self action:@selector(cityButtonDown:) forControlEvents:UIControlEventTouchUpInside]; 126 | [self.arrayCityButtons addObject:button]; 127 | [self addSubview:button]; 128 | } 129 | [button setTitle:city.cityName forState:UIControlStateNormal]; 130 | button.tag = i; 131 | } 132 | while (cityArray.count < self.arrayCityButtons.count) { 133 | [self.arrayCityButtons removeLastObject]; 134 | } 135 | } 136 | 137 | #pragma mark - Event Response 138 | - (void) cityButtonDown:(UIButton *)sender 139 | { 140 | TLCity *city = [self.cityArray objectAtIndex:sender.tag]; 141 | if (_delegate && [_delegate respondsToSelector:@selector(cityGroupCellDidSelectCity:)]) { 142 | [_delegate cityGroupCellDidSelectCity:city]; 143 | } 144 | } 145 | 146 | #pragma mark - Getter 147 | - (UILabel *) titleLabel 148 | { 149 | if (_titleLabel == nil) { 150 | _titleLabel = [[UILabel alloc] init]; 151 | [_titleLabel setFont:[UIFont systemFontOfSize:14.0]]; 152 | } 153 | return _titleLabel; 154 | } 155 | 156 | - (UILabel *) noDataLabel 157 | { 158 | if (_noDataLabel == nil) { 159 | _noDataLabel = [[UILabel alloc] init]; 160 | [_noDataLabel setText:@"暂无数据"]; 161 | [_noDataLabel setTextColor:[UIColor grayColor]]; 162 | [_noDataLabel setFont:[UIFont systemFontOfSize:14.0f]]; 163 | } 164 | return _noDataLabel; 165 | } 166 | 167 | - (NSMutableArray *) arrayCityButtons 168 | { 169 | if (_arrayCityButtons == nil) { 170 | _arrayCityButtons = [[NSMutableArray alloc] init]; 171 | } 172 | return _arrayCityButtons; 173 | } 174 | 175 | 176 | @end 177 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityHeaderView.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TLCityHeaderView : UITableViewHeaderFooterView 12 | 13 | @property (nonatomic, strong) NSString *title; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityHeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityHeaderView.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "TLCityHeaderView.h" 10 | 11 | @interface TLCityHeaderView () 12 | 13 | @property (nonatomic, strong) UILabel *titleLabel; 14 | 15 | @end 16 | 17 | @implementation TLCityHeaderView 18 | - (id) initWithReuseIdentifier:(NSString *)reuseIdentifier 19 | { 20 | if (self = [super initWithReuseIdentifier:reuseIdentifier]) { 21 | [self addSubview:self.titleLabel]; 22 | } 23 | return self; 24 | } 25 | 26 | - (void) layoutSubviews 27 | { 28 | [super layoutSubviews]; 29 | [self.titleLabel setFrame:CGRectMake(10, 0, self.frame.size.width - 10, self.frame.size.height)]; 30 | } 31 | 32 | #pragma mark - Setter 33 | - (void) setTitle:(NSString *)title 34 | { 35 | _title = title; 36 | [_titleLabel setText:title]; 37 | } 38 | 39 | #pragma mark - Getter 40 | - (UILabel *) titleLabel 41 | { 42 | if (_titleLabel == nil) { 43 | _titleLabel = [[UILabel alloc] init]; 44 | [_titleLabel setFont:[UIFont systemFontOfSize:16.0f]]; 45 | } 46 | return _titleLabel; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityPickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityPickerController.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "TLCityPickerDelegate.h" 11 | #import "TLCity.h" 12 | 13 | #define MAX_COMMON_CITY_NUMBER 8 14 | #define COMMON_CITY_DATA_KEY @"TLCityPickerCommonCityArray" 15 | 16 | @interface TLCityPickerController : UITableViewController 17 | 18 | @property (nonatomic, assign) iddelegate; 19 | 20 | /* 21 | * 定位城市id 22 | */ 23 | @property (nonatomic, strong) NSString *locationCityID; 24 | 25 | /* 26 | * 常用城市id数组,自动管理,也可赋值 27 | */ 28 | @property (nonatomic, strong) NSMutableArray *commonCitys; 29 | 30 | /* 31 | * 热门城市id数组 32 | */ 33 | @property (nonatomic, strong) NSArray *hotCitys; 34 | 35 | 36 | /* 37 | * 城市数据,可在Getter方法中重新指定 38 | */ 39 | @property (nonatomic, strong) NSMutableArray *data; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityPickerController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityPickerController.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "TLCityPickerController.h" 10 | #import "TLCityPickerSearchResultController.h" 11 | #import "TLCityHeaderView.h" 12 | #import "TLCityGroupCell.h" 13 | 14 | @interface TLCityPickerController () 15 | 16 | @property (nonatomic, strong) UISearchController *searchController; 17 | @property (nonatomic, strong) TLCityPickerSearchResultController *searchResultVC; 18 | 19 | @property (nonatomic, strong) NSMutableArray *cityData; 20 | @property (nonatomic, strong) NSMutableArray *localCityData; 21 | @property (nonatomic, strong) NSMutableArray *hotCityData; 22 | @property (nonatomic, strong) NSMutableArray *commonCityData; 23 | @property (nonatomic, strong) NSMutableArray *arraySection; 24 | 25 | @end 26 | 27 | @implementation TLCityPickerController 28 | @synthesize data = _data; 29 | @synthesize commonCitys = _commonCitys; 30 | 31 | - (void)viewDidLoad { 32 | [super viewDidLoad]; 33 | [self.navigationItem setTitle:@"城市选择"]; 34 | UIBarButtonItem *cancelBarButton = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancelButtonDown:)]; 35 | [self.navigationItem setLeftBarButtonItem:cancelBarButton]; 36 | 37 | [self.tableView setTableHeaderView:self.searchController.searchBar]; 38 | [self.tableView setSectionIndexBackgroundColor:[UIColor clearColor]]; 39 | [self.tableView setSectionIndexColor:[UIColor blackColor]]; 40 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 41 | [self.tableView registerClass:[TLCityGroupCell class] forCellReuseIdentifier:@"TLCityGroupCell"]; 42 | [self.tableView registerClass:[TLCityHeaderView class] forHeaderFooterViewReuseIdentifier:@"TLCityHeaderView"]; 43 | } 44 | 45 | 46 | #pragma mark UITableViewDataSource 47 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 48 | return self.data.count + 3; 49 | } 50 | 51 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 52 | if (section < 3) { 53 | return 1; 54 | } 55 | TLCityGroup *group = [self.data objectAtIndex:section - 3]; 56 | return group.arrayCitys.count; 57 | } 58 | 59 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 60 | if (indexPath.section < 3) { 61 | TLCityGroupCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TLCityGroupCell"]; 62 | if (indexPath.section == 0) { 63 | [cell setTitle:@"定位城市"]; 64 | [cell setCityArray:self.localCityData]; 65 | } 66 | else if (indexPath.section == 1) { 67 | [cell setTitle:@"最近访问城市"]; 68 | [cell setCityArray:self.commonCityData]; 69 | } 70 | else { 71 | [cell setTitle:@"热门城市"]; 72 | [cell setCityArray:self.hotCityData]; 73 | } 74 | [cell setDelegate:self]; 75 | return cell; 76 | } 77 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"]; 78 | TLCityGroup *group = [self.data objectAtIndex:indexPath.section - 3]; 79 | TLCity *city = [group.arrayCitys objectAtIndex:indexPath.row]; 80 | [cell.textLabel setText:city.cityName]; 81 | 82 | return cell; 83 | } 84 | 85 | #pragma mark UITableViewDelegate 86 | - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 87 | { 88 | if (section < 3) { 89 | return nil; 90 | } 91 | TLCityHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"TLCityHeaderView"]; 92 | NSString *title = [_arraySection objectAtIndex:section + 1]; 93 | [headerView setTitle:title]; 94 | return headerView; 95 | } 96 | 97 | - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 98 | { 99 | if (indexPath.section == 0) { 100 | return [TLCityGroupCell getCellHeightOfCityArray:self.localCityData]; 101 | } 102 | else if (indexPath.section == 1) { 103 | return [TLCityGroupCell getCellHeightOfCityArray:self.commonCityData]; 104 | } 105 | else if (indexPath.section == 2){ 106 | return [TLCityGroupCell getCellHeightOfCityArray:self.hotCityData]; 107 | } 108 | return 43.0f; 109 | } 110 | 111 | - (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 112 | { 113 | if (section < 3) { 114 | return 0.0f; 115 | } 116 | return 23.5f; 117 | } 118 | 119 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 120 | { 121 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 122 | if (indexPath.section < 3) { 123 | return; 124 | } 125 | TLCityGroup *group = [self.data objectAtIndex:indexPath.section - 3]; 126 | TLCity *city = [group.arrayCitys objectAtIndex:indexPath.row]; 127 | [self didSelctedCity:city]; 128 | } 129 | 130 | - (NSArray *) sectionIndexTitlesForTableView:(UITableView *)tableView 131 | { 132 | return self.arraySection; 133 | } 134 | 135 | - (NSInteger) tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index 136 | { 137 | if(index == 0) { 138 | [self.tableView scrollRectToVisible:self.searchController.searchBar.frame animated:NO]; 139 | return -1; 140 | } 141 | return index - 1; 142 | } 143 | 144 | #pragma mark TLCityGroupCellDelegate 145 | - (void) cityGroupCellDidSelectCity:(TLCity *)city 146 | { 147 | [self didSelctedCity:city]; 148 | } 149 | 150 | #pragma mark TLSearchResultControllerDelegate 151 | - (void) searchResultControllerDidSelectCity:(TLCity *)city 152 | { 153 | [self.searchController dismissViewControllerAnimated:YES completion:^{ 154 | 155 | }]; 156 | [self didSelctedCity:city]; 157 | } 158 | 159 | #pragma mark - Event Response 160 | - (void) cancelButtonDown:(UIBarButtonItem *)sender 161 | { 162 | if (_delegate && [_delegate respondsToSelector:@selector(cityPickerControllerDidCancel:)]) { 163 | [_delegate cityPickerControllerDidCancel:self]; 164 | } 165 | } 166 | 167 | #pragma mark - Private Methods 168 | - (void) didSelctedCity:(TLCity *)city 169 | { 170 | if (_delegate && [_delegate respondsToSelector:@selector(cityPickerController:didSelectCity:)]) { 171 | [_delegate cityPickerController:self didSelectCity:city]; 172 | } 173 | 174 | if (self.commonCitys.count >= MAX_COMMON_CITY_NUMBER) { 175 | [self.commonCitys removeLastObject]; 176 | } 177 | for (NSString *str in self.commonCitys) { 178 | if ([city.cityID isEqualToString:str]) { 179 | [self.commonCitys removeObject:str]; 180 | break; 181 | } 182 | } 183 | [self.commonCitys insertObject:city.cityID atIndex:0]; 184 | [[NSUserDefaults standardUserDefaults] setValue:self.commonCitys forKey:COMMON_CITY_DATA_KEY]; 185 | [[NSUserDefaults standardUserDefaults] synchronize]; 186 | } 187 | 188 | #pragma mark - Setter 189 | - (void) setCommonCitys:(NSMutableArray *)commonCitys 190 | { 191 | _commonCitys = commonCitys; 192 | if (commonCitys != nil && commonCitys.count > 0) { 193 | [[NSUserDefaults standardUserDefaults] setValue:commonCitys forKey:COMMON_CITY_DATA_KEY]; 194 | [[NSUserDefaults standardUserDefaults] synchronize]; 195 | } 196 | } 197 | 198 | #pragma mark - Getter 199 | - (UISearchController *) searchController 200 | { 201 | if (_searchController == nil) { 202 | _searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultVC]; 203 | [_searchController.searchBar setPlaceholder:@"请输入城市中文名称或拼音"]; 204 | [_searchController.searchBar setBarTintColor:[UIColor colorWithWhite:0.95 alpha:1.0]]; 205 | [_searchController.searchBar sizeToFit]; 206 | [_searchController setSearchResultsUpdater:self.searchResultVC]; 207 | [_searchController.searchBar.layer setBorderWidth:0.5f]; 208 | [_searchController.searchBar.layer setBorderColor:[UIColor colorWithWhite:0.7 alpha:1.0].CGColor]; 209 | } 210 | return _searchController; 211 | } 212 | 213 | - (TLCityPickerSearchResultController *) searchResultVC 214 | { 215 | if (_searchResultVC == nil) { 216 | _searchResultVC = [[TLCityPickerSearchResultController alloc] init]; 217 | _searchResultVC.cityData = self.cityData; 218 | _searchResultVC.searchResultDelegate = self; 219 | } 220 | return _searchResultVC; 221 | } 222 | 223 | - (NSMutableArray *) data 224 | { 225 | if (_data == nil) { 226 | NSArray *array = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"CityData" ofType:@"plist"]]; 227 | _data = [[NSMutableArray alloc] init]; 228 | for (NSDictionary *groupDic in array) { 229 | TLCityGroup *group = [[TLCityGroup alloc] init]; 230 | group.groupName = [groupDic objectForKey:@"initial"]; 231 | for (NSDictionary *dic in [groupDic objectForKey:@"citys"]) { 232 | TLCity *city = [[TLCity alloc] init]; 233 | city.cityID = [dic objectForKey:@"city_key"]; 234 | city.cityName = [dic objectForKey:@"city_name"]; 235 | city.shortName = [dic objectForKey:@"short_name"]; 236 | city.pinyin = [dic objectForKey:@"pinyin"]; 237 | city.initials = [dic objectForKey:@"initials"]; 238 | [group.arrayCitys addObject:city]; 239 | [self.cityData addObject:city]; 240 | } 241 | [self.arraySection addObject:group.groupName]; 242 | [_data addObject:group]; 243 | } 244 | } 245 | return _data; 246 | } 247 | 248 | - (NSMutableArray *) cityData 249 | { 250 | if (_cityData == nil) { 251 | _cityData = [[NSMutableArray alloc] init]; 252 | } 253 | return _cityData; 254 | } 255 | 256 | - (NSMutableArray *) localCityData 257 | { 258 | if (_localCityData == nil) { 259 | _localCityData = [[NSMutableArray alloc] init]; 260 | if (self.locationCityID != nil) { 261 | TLCity *city = nil; 262 | for (TLCity *item in self.cityData) { 263 | if ([item.cityID isEqualToString:self.locationCityID]) { 264 | city = item; 265 | break; 266 | } 267 | } 268 | if (city == nil) { 269 | NSLog(@"Not Found City: %@", self.locationCityID); 270 | } 271 | else { 272 | [_localCityData addObject:city]; 273 | } 274 | } 275 | } 276 | return _localCityData; 277 | } 278 | 279 | - (NSMutableArray *) hotCityData 280 | { 281 | if (_hotCityData == nil) { 282 | _hotCityData = [[NSMutableArray alloc] init]; 283 | for (NSString *str in self.hotCitys) { 284 | TLCity *city = nil; 285 | for (TLCity *item in self.cityData) { 286 | if ([item.cityID isEqualToString:str]) { 287 | city = item; 288 | break; 289 | } 290 | } 291 | if (city == nil) { 292 | NSLog(@"Not Found City: %@", str); 293 | } 294 | else { 295 | [_hotCityData addObject:city]; 296 | } 297 | } 298 | } 299 | return _hotCityData; 300 | } 301 | 302 | - (NSMutableArray *) commonCityData 303 | { 304 | if (_commonCityData == nil) { 305 | _commonCityData = [[NSMutableArray alloc] init]; 306 | for (NSString *str in self.commonCitys) { 307 | TLCity *city = nil; 308 | for (TLCity *item in self.cityData) { 309 | if ([item.cityID isEqualToString:str]) { 310 | city = item; 311 | break; 312 | } 313 | } 314 | if (city == nil) { 315 | NSLog(@"Not Found City: %@", str); 316 | } 317 | else { 318 | [_commonCityData addObject:city]; 319 | } 320 | } 321 | } 322 | return _commonCityData; 323 | } 324 | 325 | - (NSMutableArray *) arraySection 326 | { 327 | if (_arraySection == nil) { 328 | _arraySection = [[NSMutableArray alloc] initWithObjects:UITableViewIndexSearch, @"定位", @"最近", @"最热", nil]; 329 | } 330 | return _arraySection; 331 | } 332 | 333 | - (NSMutableArray *) commonCitys 334 | { 335 | if (_commonCitys == nil) { 336 | NSArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:COMMON_CITY_DATA_KEY]; 337 | _commonCitys = (array == nil ? [[NSMutableArray alloc] init] : [[NSMutableArray alloc] initWithArray:array copyItems:YES]); 338 | } 339 | return _commonCitys; 340 | } 341 | 342 | @end 343 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityPickerDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityPickerDelegate.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class TLCity; 12 | @class TLCityPickerController; 13 | 14 | @protocol TLCityPickerDelegate 15 | 16 | - (void) cityPickerController:(TLCityPickerController *)cityPickerViewController 17 | didSelectCity:(TLCity *)city; 18 | 19 | - (void) cityPickerControllerDidCancel:(TLCityPickerController *)cityPickerViewController; 20 | 21 | @end 22 | 23 | @protocol TLCityGroupCellDelegate 24 | 25 | - (void) cityGroupCellDidSelectCity:(TLCity *)city; 26 | 27 | @end 28 | 29 | @protocol TLSearchResultControllerDelegate 30 | 31 | - (void) searchResultControllerDidSelectCity:(TLCity *)city; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityPickerSearchResultController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityPickerSearchResultController.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "TLCityPickerDelegate.h" 11 | 12 | @interface TLCityPickerSearchResultController : UITableViewController 13 | 14 | @property (nonatomic, assign) idsearchResultDelegate; 15 | 16 | @property (nonatomic, strong) NSArray *cityData; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /TLCityPicker/TLCityPickerSearchResultController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TLCityPickerSearchResultController.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "TLCityPickerSearchResultController.h" 10 | #import "TLCity.h" 11 | 12 | @interface TLCityPickerSearchResultController () 13 | 14 | @property (nonatomic, strong) NSMutableArray *data; 15 | 16 | @end 17 | 18 | @implementation TLCityPickerSearchResultController 19 | 20 | - (void) viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | [self setAutomaticallyAdjustsScrollViewInsets:NO]; 24 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 25 | } 26 | 27 | - (void) viewWillAppear:(BOOL)animated 28 | { 29 | [super viewWillAppear:animated]; 30 | [self.tableView setFrame:CGRectMake(0, 64, self.view.frame.size.width, [UIScreen mainScreen].bounds.size.height - 64)]; 31 | } 32 | 33 | #pragma mark - UITableViewDataSource 34 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 35 | return 1; 36 | } 37 | 38 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 39 | return self.data.count; 40 | } 41 | 42 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 43 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"]; 44 | TLCity *city = [self.data objectAtIndex:indexPath.row]; 45 | [cell.textLabel setText:city.cityName]; 46 | return cell; 47 | } 48 | 49 | #pragma mark - UITableViewDelegate 50 | - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 51 | { 52 | return 43.0f; 53 | } 54 | 55 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 56 | { 57 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 58 | 59 | TLCity *city = [self.data objectAtIndex:indexPath.row]; 60 | if (_searchResultDelegate && [_searchResultDelegate respondsToSelector:@selector(searchResultControllerDidSelectCity:)]) { 61 | [_searchResultDelegate searchResultControllerDidSelectCity:city]; 62 | } 63 | } 64 | 65 | 66 | #pragma mark - UISearchResultsUpdating 67 | - (void) updateSearchResultsForSearchController:(UISearchController *)searchController 68 | { 69 | NSString *searchText = searchController.searchBar.text; 70 | [self.data removeAllObjects]; 71 | for (TLCity *city in self.cityData){ 72 | if ([city.cityName containsString:searchText] || [city.pinyin containsString:searchText] || [city.initials containsString:searchText]) { 73 | [self.data addObject:city]; 74 | } 75 | } 76 | [self.tableView reloadData]; 77 | } 78 | 79 | #pragma mark - Getter 80 | - (NSMutableArray *) data 81 | { 82 | if (_data == nil) { 83 | _data = [[NSMutableArray alloc] init]; 84 | } 85 | return _data; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /TLCityPickerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C21FDDFB1BEB8C07009D6C11 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C21FDDFA1BEB8C07009D6C11 /* Launch Screen.xib */; }; 11 | C21FDE091BEBB2CF009D6C11 /* CityData.plist in Resources */ = {isa = PBXBuildFile; fileRef = C21FDDFD1BEBB2CF009D6C11 /* CityData.plist */; }; 12 | C21FDE0A1BEBB2CF009D6C11 /* TLCity.m in Sources */ = {isa = PBXBuildFile; fileRef = C21FDDFF1BEBB2CF009D6C11 /* TLCity.m */; }; 13 | C21FDE0B1BEBB2CF009D6C11 /* TLCityGroupCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C21FDE011BEBB2CF009D6C11 /* TLCityGroupCell.m */; }; 14 | C21FDE0C1BEBB2CF009D6C11 /* TLCityHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = C21FDE031BEBB2CF009D6C11 /* TLCityHeaderView.m */; }; 15 | C21FDE0D1BEBB2CF009D6C11 /* TLCityPickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = C21FDE051BEBB2CF009D6C11 /* TLCityPickerController.m */; }; 16 | C21FDE0E1BEBB2CF009D6C11 /* TLCityPickerSearchResultController.m in Sources */ = {isa = PBXBuildFile; fileRef = C21FDE081BEBB2CF009D6C11 /* TLCityPickerSearchResultController.m */; }; 17 | C24BC1931BEB2F2C0067ED8C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C24BC1921BEB2F2C0067ED8C /* main.m */; }; 18 | C24BC1961BEB2F2C0067ED8C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C24BC1951BEB2F2C0067ED8C /* AppDelegate.m */; }; 19 | C24BC1991BEB2F2C0067ED8C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C24BC1981BEB2F2C0067ED8C /* ViewController.m */; }; 20 | C24BC19E1BEB2F2C0067ED8C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C24BC19D1BEB2F2C0067ED8C /* Assets.xcassets */; }; 21 | C24BC1B11BEB34290067ED8C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C24BC1B01BEB34290067ED8C /* Main.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | C21FDDFA1BEB8C07009D6C11 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; 26 | C21FDDFD1BEBB2CF009D6C11 /* CityData.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = CityData.plist; sourceTree = ""; }; 27 | C21FDDFE1BEBB2CF009D6C11 /* TLCity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLCity.h; sourceTree = ""; }; 28 | C21FDDFF1BEBB2CF009D6C11 /* TLCity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLCity.m; sourceTree = ""; }; 29 | C21FDE001BEBB2CF009D6C11 /* TLCityGroupCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLCityGroupCell.h; sourceTree = ""; }; 30 | C21FDE011BEBB2CF009D6C11 /* TLCityGroupCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLCityGroupCell.m; sourceTree = ""; }; 31 | C21FDE021BEBB2CF009D6C11 /* TLCityHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLCityHeaderView.h; sourceTree = ""; }; 32 | C21FDE031BEBB2CF009D6C11 /* TLCityHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLCityHeaderView.m; sourceTree = ""; }; 33 | C21FDE041BEBB2CF009D6C11 /* TLCityPickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLCityPickerController.h; sourceTree = ""; }; 34 | C21FDE051BEBB2CF009D6C11 /* TLCityPickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLCityPickerController.m; sourceTree = ""; }; 35 | C21FDE061BEBB2CF009D6C11 /* TLCityPickerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLCityPickerDelegate.h; sourceTree = ""; }; 36 | C21FDE071BEBB2CF009D6C11 /* TLCityPickerSearchResultController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLCityPickerSearchResultController.h; sourceTree = ""; }; 37 | C21FDE081BEBB2CF009D6C11 /* TLCityPickerSearchResultController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLCityPickerSearchResultController.m; sourceTree = ""; }; 38 | C24BC18E1BEB2F2C0067ED8C /* TLCityPickerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TLCityPickerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | C24BC1921BEB2F2C0067ED8C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 40 | C24BC1941BEB2F2C0067ED8C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | C24BC1951BEB2F2C0067ED8C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | C24BC1971BEB2F2C0067ED8C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | C24BC1981BEB2F2C0067ED8C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | C24BC19D1BEB2F2C0067ED8C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | C24BC1A21BEB2F2C0067ED8C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | C24BC1B01BEB34290067ED8C /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | C24BC18B1BEB2F2C0067ED8C /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | C21FDDFC1BEBB2CF009D6C11 /* TLCityPicker */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | C21FDDFD1BEBB2CF009D6C11 /* CityData.plist */, 64 | C21FDDFE1BEBB2CF009D6C11 /* TLCity.h */, 65 | C21FDDFF1BEBB2CF009D6C11 /* TLCity.m */, 66 | C21FDE001BEBB2CF009D6C11 /* TLCityGroupCell.h */, 67 | C21FDE011BEBB2CF009D6C11 /* TLCityGroupCell.m */, 68 | C21FDE021BEBB2CF009D6C11 /* TLCityHeaderView.h */, 69 | C21FDE031BEBB2CF009D6C11 /* TLCityHeaderView.m */, 70 | C21FDE041BEBB2CF009D6C11 /* TLCityPickerController.h */, 71 | C21FDE051BEBB2CF009D6C11 /* TLCityPickerController.m */, 72 | C21FDE061BEBB2CF009D6C11 /* TLCityPickerDelegate.h */, 73 | C21FDE071BEBB2CF009D6C11 /* TLCityPickerSearchResultController.h */, 74 | C21FDE081BEBB2CF009D6C11 /* TLCityPickerSearchResultController.m */, 75 | ); 76 | path = TLCityPicker; 77 | sourceTree = SOURCE_ROOT; 78 | }; 79 | C24BC1851BEB2F2C0067ED8C = { 80 | isa = PBXGroup; 81 | children = ( 82 | C24BC1901BEB2F2C0067ED8C /* TLCityPickerDemo */, 83 | C24BC18F1BEB2F2C0067ED8C /* Products */, 84 | ); 85 | sourceTree = ""; 86 | }; 87 | C24BC18F1BEB2F2C0067ED8C /* Products */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | C24BC18E1BEB2F2C0067ED8C /* TLCityPickerDemo.app */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | C24BC1901BEB2F2C0067ED8C /* TLCityPickerDemo */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | C21FDDFC1BEBB2CF009D6C11 /* TLCityPicker */, 99 | C24BC1941BEB2F2C0067ED8C /* AppDelegate.h */, 100 | C24BC1951BEB2F2C0067ED8C /* AppDelegate.m */, 101 | C24BC1971BEB2F2C0067ED8C /* ViewController.h */, 102 | C24BC1981BEB2F2C0067ED8C /* ViewController.m */, 103 | C24BC1B01BEB34290067ED8C /* Main.storyboard */, 104 | C24BC1911BEB2F2C0067ED8C /* Supporting Files */, 105 | ); 106 | path = TLCityPickerDemo; 107 | sourceTree = ""; 108 | }; 109 | C24BC1911BEB2F2C0067ED8C /* Supporting Files */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | C24BC1A21BEB2F2C0067ED8C /* Info.plist */, 113 | C24BC19D1BEB2F2C0067ED8C /* Assets.xcassets */, 114 | C24BC1921BEB2F2C0067ED8C /* main.m */, 115 | C21FDDFA1BEB8C07009D6C11 /* Launch Screen.xib */, 116 | ); 117 | name = "Supporting Files"; 118 | sourceTree = ""; 119 | }; 120 | /* End PBXGroup section */ 121 | 122 | /* Begin PBXNativeTarget section */ 123 | C24BC18D1BEB2F2C0067ED8C /* TLCityPickerDemo */ = { 124 | isa = PBXNativeTarget; 125 | buildConfigurationList = C24BC1A51BEB2F2C0067ED8C /* Build configuration list for PBXNativeTarget "TLCityPickerDemo" */; 126 | buildPhases = ( 127 | C24BC18A1BEB2F2C0067ED8C /* Sources */, 128 | C24BC18B1BEB2F2C0067ED8C /* Frameworks */, 129 | C24BC18C1BEB2F2C0067ED8C /* Resources */, 130 | ); 131 | buildRules = ( 132 | ); 133 | dependencies = ( 134 | ); 135 | name = TLCityPickerDemo; 136 | productName = TLCityPickerDemo; 137 | productReference = C24BC18E1BEB2F2C0067ED8C /* TLCityPickerDemo.app */; 138 | productType = "com.apple.product-type.application"; 139 | }; 140 | /* End PBXNativeTarget section */ 141 | 142 | /* Begin PBXProject section */ 143 | C24BC1861BEB2F2C0067ED8C /* Project object */ = { 144 | isa = PBXProject; 145 | attributes = { 146 | LastUpgradeCheck = 0710; 147 | ORGANIZATIONNAME = "李伯坤"; 148 | TargetAttributes = { 149 | C24BC18D1BEB2F2C0067ED8C = { 150 | CreatedOnToolsVersion = 7.1; 151 | }; 152 | }; 153 | }; 154 | buildConfigurationList = C24BC1891BEB2F2C0067ED8C /* Build configuration list for PBXProject "TLCityPickerDemo" */; 155 | compatibilityVersion = "Xcode 3.2"; 156 | developmentRegion = English; 157 | hasScannedForEncodings = 0; 158 | knownRegions = ( 159 | en, 160 | Base, 161 | ); 162 | mainGroup = C24BC1851BEB2F2C0067ED8C; 163 | productRefGroup = C24BC18F1BEB2F2C0067ED8C /* Products */; 164 | projectDirPath = ""; 165 | projectRoot = ""; 166 | targets = ( 167 | C24BC18D1BEB2F2C0067ED8C /* TLCityPickerDemo */, 168 | ); 169 | }; 170 | /* End PBXProject section */ 171 | 172 | /* Begin PBXResourcesBuildPhase section */ 173 | C24BC18C1BEB2F2C0067ED8C /* Resources */ = { 174 | isa = PBXResourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | C24BC1B11BEB34290067ED8C /* Main.storyboard in Resources */, 178 | C21FDDFB1BEB8C07009D6C11 /* Launch Screen.xib in Resources */, 179 | C24BC19E1BEB2F2C0067ED8C /* Assets.xcassets in Resources */, 180 | C21FDE091BEBB2CF009D6C11 /* CityData.plist in Resources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXResourcesBuildPhase section */ 185 | 186 | /* Begin PBXSourcesBuildPhase section */ 187 | C24BC18A1BEB2F2C0067ED8C /* Sources */ = { 188 | isa = PBXSourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | C21FDE0B1BEBB2CF009D6C11 /* TLCityGroupCell.m in Sources */, 192 | C21FDE0A1BEBB2CF009D6C11 /* TLCity.m in Sources */, 193 | C21FDE0D1BEBB2CF009D6C11 /* TLCityPickerController.m in Sources */, 194 | C21FDE0C1BEBB2CF009D6C11 /* TLCityHeaderView.m in Sources */, 195 | C24BC1991BEB2F2C0067ED8C /* ViewController.m in Sources */, 196 | C24BC1961BEB2F2C0067ED8C /* AppDelegate.m in Sources */, 197 | C24BC1931BEB2F2C0067ED8C /* main.m in Sources */, 198 | C21FDE0E1BEBB2CF009D6C11 /* TLCityPickerSearchResultController.m in Sources */, 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | }; 202 | /* End PBXSourcesBuildPhase section */ 203 | 204 | /* Begin XCBuildConfiguration section */ 205 | C24BC1A31BEB2F2C0067ED8C /* Debug */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_ENABLE_MODULES = YES; 212 | CLANG_ENABLE_OBJC_ARC = YES; 213 | CLANG_WARN_BOOL_CONVERSION = YES; 214 | CLANG_WARN_CONSTANT_CONVERSION = YES; 215 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 216 | CLANG_WARN_EMPTY_BODY = YES; 217 | CLANG_WARN_ENUM_CONVERSION = YES; 218 | CLANG_WARN_INT_CONVERSION = YES; 219 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 223 | COPY_PHASE_STRIP = NO; 224 | DEBUG_INFORMATION_FORMAT = dwarf; 225 | ENABLE_STRICT_OBJC_MSGSEND = YES; 226 | ENABLE_TESTABILITY = YES; 227 | GCC_C_LANGUAGE_STANDARD = gnu99; 228 | GCC_DYNAMIC_NO_PIC = NO; 229 | GCC_NO_COMMON_BLOCKS = YES; 230 | GCC_OPTIMIZATION_LEVEL = 0; 231 | GCC_PREPROCESSOR_DEFINITIONS = ( 232 | "DEBUG=1", 233 | "$(inherited)", 234 | ); 235 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 236 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 237 | GCC_WARN_UNDECLARED_SELECTOR = YES; 238 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 239 | GCC_WARN_UNUSED_FUNCTION = YES; 240 | GCC_WARN_UNUSED_VARIABLE = YES; 241 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 242 | MTL_ENABLE_DEBUG_INFO = YES; 243 | ONLY_ACTIVE_ARCH = YES; 244 | SDKROOT = iphoneos; 245 | }; 246 | name = Debug; 247 | }; 248 | C24BC1A41BEB2F2C0067ED8C /* Release */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 253 | CLANG_CXX_LIBRARY = "libc++"; 254 | CLANG_ENABLE_MODULES = YES; 255 | CLANG_ENABLE_OBJC_ARC = YES; 256 | CLANG_WARN_BOOL_CONVERSION = YES; 257 | CLANG_WARN_CONSTANT_CONVERSION = YES; 258 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 266 | COPY_PHASE_STRIP = NO; 267 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 268 | ENABLE_NS_ASSERTIONS = NO; 269 | ENABLE_STRICT_OBJC_MSGSEND = YES; 270 | GCC_C_LANGUAGE_STANDARD = gnu99; 271 | GCC_NO_COMMON_BLOCKS = YES; 272 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 273 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 274 | GCC_WARN_UNDECLARED_SELECTOR = YES; 275 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 276 | GCC_WARN_UNUSED_FUNCTION = YES; 277 | GCC_WARN_UNUSED_VARIABLE = YES; 278 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 279 | MTL_ENABLE_DEBUG_INFO = NO; 280 | SDKROOT = iphoneos; 281 | VALIDATE_PRODUCT = YES; 282 | }; 283 | name = Release; 284 | }; 285 | C24BC1A61BEB2F2C0067ED8C /* Debug */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | INFOPLIST_FILE = TLCityPickerDemo/Info.plist; 290 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 291 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 292 | PRODUCT_BUNDLE_IDENTIFIER = com.tbl00c.TLCityPickerDemo; 293 | PRODUCT_NAME = "$(TARGET_NAME)"; 294 | }; 295 | name = Debug; 296 | }; 297 | C24BC1A71BEB2F2C0067ED8C /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 301 | INFOPLIST_FILE = TLCityPickerDemo/Info.plist; 302 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 303 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 304 | PRODUCT_BUNDLE_IDENTIFIER = com.tbl00c.TLCityPickerDemo; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | }; 307 | name = Release; 308 | }; 309 | /* End XCBuildConfiguration section */ 310 | 311 | /* Begin XCConfigurationList section */ 312 | C24BC1891BEB2F2C0067ED8C /* Build configuration list for PBXProject "TLCityPickerDemo" */ = { 313 | isa = XCConfigurationList; 314 | buildConfigurations = ( 315 | C24BC1A31BEB2F2C0067ED8C /* Debug */, 316 | C24BC1A41BEB2F2C0067ED8C /* Release */, 317 | ); 318 | defaultConfigurationIsVisible = 0; 319 | defaultConfigurationName = Release; 320 | }; 321 | C24BC1A51BEB2F2C0067ED8C /* Build configuration list for PBXNativeTarget "TLCityPickerDemo" */ = { 322 | isa = XCConfigurationList; 323 | buildConfigurations = ( 324 | C24BC1A61BEB2F2C0067ED8C /* Debug */, 325 | C24BC1A71BEB2F2C0067ED8C /* Release */, 326 | ); 327 | defaultConfigurationIsVisible = 0; 328 | defaultConfigurationName = Release; 329 | }; 330 | /* End XCConfigurationList section */ 331 | }; 332 | rootObject = C24BC1861BEB2F2C0067ED8C /* Project object */; 333 | } 334 | -------------------------------------------------------------------------------- /TLCityPickerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TLCityPickerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /TLCityPickerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /TLCityPickerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /TLCityPickerDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | Launch Screen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /TLCityPickerDemo/Launch Screen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /TLCityPickerDemo/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /TLCityPickerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /TLCityPickerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TLCityPickerController.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UIButton *cityPickerButton; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | } 24 | 25 | - (IBAction)cityPickerButtonDown:(UIButton *)sender { 26 | TLCityPickerController *cityPickerVC = [[TLCityPickerController alloc] init]; 27 | [cityPickerVC setDelegate:self]; 28 | 29 | cityPickerVC.locationCityID = @"1400010000"; 30 | // cityPickerVC.commonCitys = [[NSMutableArray alloc] initWithArray: @[@"1400010000", @"100010000"]]; // 最近访问城市,如果不设置,将自动管理 31 | cityPickerVC.hotCitys = @[@"100010000", @"200010000", @"300210000", @"600010000", @"300110000"]; 32 | 33 | [self presentViewController:[[UINavigationController alloc] initWithRootViewController:cityPickerVC] animated:YES completion:^{ 34 | 35 | }]; 36 | } 37 | 38 | #pragma mark - TLCityPickerDelegate 39 | - (void) cityPickerController:(TLCityPickerController *)cityPickerViewController didSelectCity:(TLCity *)city 40 | { 41 | [self.cityPickerButton setTitle:city.cityName forState:UIControlStateNormal]; 42 | [cityPickerViewController dismissViewControllerAnimated:YES completion:^{ 43 | 44 | }]; 45 | } 46 | 47 | - (void) cityPickerControllerDidCancel:(TLCityPickerController *)cityPickerViewController 48 | { 49 | [cityPickerViewController dismissViewControllerAnimated:YES completion:^{ 50 | 51 | }]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /TLCityPickerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TLCityPickerDemo 4 | // 5 | // Created by 李伯坤 on 15/11/5. 6 | // Copyright © 2015年 李伯坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | --------------------------------------------------------------------------------