MICountryPicker 0.1.9

MICountryPicker 0.1.9

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布日期最新发布日期2016年7月
SPM支持SPM

Mustafa Ibrahim维护。



MICountryPicker

MICountryPicker是一个支持搜索的iOS8+国家选择控制器,国家列表基于ISO 3166国家代码标准(http://en.wikipedia.org/wiki/ISO_3166-1)。此外,该库包括了从https://github.com/pradyumnad/Country-List获得的250个公有领域国旗图片。

屏幕截图

alt tag alt tag alt tag

安装

MICountryPicker可以通过CocoaPods获取,要安装它,只需将以下行添加到Podfile即可

use_frameworks!
pod 'MICountryPicker'

从UIViewController显示MICountryPicker

let picker = MICountryPicker()
navigationController?.pushViewController(picker, animated: true)

MICountryPickerDelegate 协议

// delegate
picker.delegate = self

// Optionally, set this to display the country calling codes after the names
picker.showCallingCodes = true
func countryPicker(picker: MICountryPicker, didSelectCountryWithName name: String, code: String) {
        print(code)
}

func countryPicker(picker: MICountryPicker, didSelectCountryWithName name: String, code: String, dialCode: String) {
        print(dialCode)
}

闭包

// or closure
picker.didSelectCountryClosure = { name, code in
        print(code)
}

picker.didSelectCountryWithCallingCodeClosure = { name, code, dialCode in
        print(dialCode)
}

作者

Mustafa Ibrahim, [email protected]

注意事项

适用于iOS 8+。

许可证

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