将 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 文件。