SwiftyCountryPicker
示例
要运行示例项目,先克隆仓库,然后再从 Example 目录运行 pod install
。
截图:-
要求
库不依赖于任何第三方库。
安装
SwiftyCountryPicker 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'SwiftyCountryPicker'
基本配置
1- 在你的storyBoard中添加一个pickerView。2- 在属性检查器中,将pickerView的类名设置为 ruby CountryPickerView
3- 在ViewController中为countryPicker创建一个出口。
ruby@IBOutlet weak var pickerView:CountryPickerView!
3- 在你的viewController中添加以下代码以设置countryPicker
ruby pickerView.setCountryPickerView(hideflag: false, countryName: false, countryCode: false, countrydialCode: false)
4- 你可以在picker上方添加自己的完成和取消按钮。按下完成按钮时,可以调用以下闭包来获取所选国家及其他信息。
pickerView.getSelctedCountry { (data) in print(data.countryCode)}
作者
anpkmr, [email protected]
许可证
SwiftyCountryPicker遵循MIT许可证。更多信息和LICENSE文件。