SwiftCountryPicker 1.0.1

SwiftCountryPicker 1.0.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2017年1月
SwiftSwift 版本3.0
SPM支持 SPM

Samuel Beek 维护。




  • Samuel Beek

SwiftCountryPicker

Image

使用方法

要运行示例项目,请克隆仓库,然后先从 Example 目录运行 pod install

对于最清晰的示例,查看示例项目

创建一个新的 CountryPicker

let countryPicker = CountryPicker(frame: CGRectMake(0,0,self.view.frame.size.width, 216))
countryPicker.countryDelegate = self

为了检索选择的国家,ViewController 必须遵从 CountryPickerDelegate 协议,通过在文件的底部添加以下代码片段来实现

func countryPicker(picker: CountryPicker, didSelectCountry country: Country) {
    // do whatever you want with the picked Counrty
}

要将 CountryPicker 添加为 textField 的输入视图

textField = UITextField(frame: CGRectMake(0,0,40,30))
textField.inputView = countryPicker
view.addSubview(textField)

需求

iOS 9 或更高版本

安装

SwiftCountryPicker 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中即可。

pod "SwiftCountryPicker"

或者使用 Carthage 安装

github "samuelbeek/SwiftCountryPicker"

将以下行添加到您想使用 CountryPicker 的文件顶部

import SwiftCountryPicker 

作者

Samuel Beek,[email protected]twitter

许可证

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