GCCountryPicker 2.5.0

GCCountryPicker 2.5.0

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最后发布2019年3月
SPM支持 SPM

Gray Campbell 维护。



  • Gray Campbell

banner

Release CocoaPods Documentation Codacy Code Quality Swift 4 Compatible Platform License

CocoaPods

pod 'GCCountryPicker'

实现

  1. 将 GCCountryPicker 添加到您的文件导入语句中。

    import GCCountryPicker
    
  2. 创建 GCCountryPickerViewController 的实例。

    let countryPickerViewController = GCCountryPickerViewController(displayMode: .withoutCallingCodes)
    
  3. 设置委托、数据源(可选)和导航标题。

    countryPickerViewController.delegate = self
    countryPickerViewController.dataSource = self
    countryPickerViewController.navigationItem.title = "Countries"
    
  4. 将国家选择器视图控制器嵌入到导航控制器中。

    let navigationController = UINavigationController(rootViewController: countryPickerViewController)
    
  5. 展示导航控制器。

    self.present(navigationController, animated: true, completion: nil)
    
  6. 实现 GCCountryPickerDelegate。

    func countryPickerDidCancel(_ countryPicker: GCCountryPickerViewController)
    
    func countryPicker(_ countryPicker: GCCountryPickerViewController, didSelectCountry country: GCCountry)
    
  7. 根据需要实现 GCCountryPickerDataSource。

    func countryCodes(for countryPicker: GCCountryPickerViewController) -> [String]
    

文档

许可

GCCountryPicker 在 MIT 许可下可用。有关更多信息,请参阅许可文件