iOS7+ 的国家选择表格视图控制器。
它支持便捷的搜索和动态字体。
为了安装 CountryPicker
,您需要将 CountryPicker
文件夹复制到您的 Xcode 项目中。
为了使用 CountryPicker
,您需要 #import "SLCountryPickerViewController.h"
并将以下代码包含到您的项目中
SLCountryPickerViewController *vc = [[SLCountryPickerViewController alloc]init];
vc.completionBlock = ^(NSString *country, NSString *code){
//Your code here
_countryNameLabel.text = country;
_countryImageView.image = [UIImage imageNamed:code];
_countryCodeLabel.text = code;
};
//
[self.navigationController pushViewController:vc animated:YES];
在完成块中获得国家和国家代码字符串。
美丽的旗帜图像来自 https://github.com/koppi/iso-country-flags-svg-collection
CountryPicker
由 Dmitry Shmidt 编写。网站:www.shmidtlab.com
Twitter:http://twitter.com/shmidtlab
E-mail [email protected]
CountryPicker
采用 MIT 许可证许可。