AwesomeContactPicker
示例
要运行示例项目,请克隆仓库,然后首先从示例目录运行 pod install
。
需求
iOS: 11.0
安装
AwesomeContactPicker 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:
pod 'AwesomeContactPicker'
使用方法
通过调用以下方法来显示联系人类UI
AwesomeContactPicker.shared.openContacts(with: YourViewController, delegate: YourDelegateObject)
通过单击它们选择/取消选择联系人
在搜索框中输入以搜索联系人
配置UI
// Pre select contacts
AwesomeContactSettings.preSelectedContacts = ["contact1", "contact2"]
// Nav bar
AwesomeContactSettings.navBarBarTintColor = .orange
AwesomeContactSettings.navBarTintColor = .purple
AwesomeContactSettings.navBarTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black]
// Section index
AwesomeContactSettings.sectionIndexHidden = false
AwesomeContactSettings.sectionIndexColor = .white
委托
让YourViewController符合AwesomeContactPickerProtocol
extension ViewController: AwesomeContactPickerProtocol {
func didDismiss(with type: AwesomeContactPicker.DismissType, contacts: Set<String>?) {
switch type {
case .done:
// Do something with the contacts
default:
break
}
}
}
作者
Michael Guo, [email protected]
许可
AwesomeContactPicker可在MIT许可下使用。有关更多信息,请参阅LICENSE文件。