CCTryCountrySelector 2.4

CCTryCountrySelector 2.4

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2021年2月
SPM支持 SPM

Chad Chang 维护。



  • Chang Chad

CCTryCountrySelector

DEMO

用法

将 CCtryCountrySelectorView 添加到您的视图中,然后遵循 CountrySelectorViewDelegate 协议

  • showPickInView() 返回一个放置 UIPickerView 的视图
  func showPickInView()->UIView {
    return self.view
  }
  • phoneCodeDidChange() 会收到用户选择的国家的电话代码。
  func phoneCodeDidChange(phoneCode: String) {
    print(phoneCode)
  }
  • customPickerView(countryData: CountryData) 返回一个选择器视图
    func customPickerView(countryData: CountryData) -> UIView {

        return DefaulCountryPickView.init(countryData: countryData)
    //  use custom view if needed
    //  return CustomCountryPickerView.init(countryData: countryData)
    }

可选

  • 使用 setDefaultCountry() 设置初始国家。
  selectView.setDefaultCountry("TW")
  • 通过向 setFrequentCountryList() 传递字符串数组来标记常用。
  selectView.setFrequentCountryList(["TW","US"])
  • 通过向 setRestrictCountry() 传递字符串数组来显示所需的国家。
  selectView.setRestrictCountry(["TW","US","CA"])
  • 通过向 setFlagHidden() 传递布尔值来设置标志图片隐藏或显示。
  selectView.setFlagHidden(true)

安装

CCTryCountrySelector 可通过 CocoaPods 获取。要安装它,只需在 Podfile 中添加以下行

pod "CCCountrySelector" , '~>  1.5'  // Swift 2.3
pod "CCCountrySelector" , '~>  2.0'  // Swift 3.0

待办事项

作者

Chang Chad, chadchang.tw at gmail.com

许可证

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

致谢