MGSelector
MGSelector 是一个定制的 iOS 表格选择器。
示例
要运行示例项目,先克隆仓库,然后从 Example 目录中首先运行 pod install
。
安装
MGSelector 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行
pod 'MGSelector'
文档
首先准备好确认 MGSelectorModel 协议的模型。
struct Option: MGSelectorOption {
var title: String
var detail: String?
}
在你的视图控制器中确认 MGSelectable 协议,并调用 openSelector
方法。
let options: [Options] = ...
class ViewController: UIViewController, MGSelectable {
//...
@IBAction func open(_ sender: UIButton) {
openSelector(title: "Title", options: options, theme: .dark)
}
func didSelect(option: MGSelectorOption) {
title = option.title
}
}
使用 didSelect
协议方法获取选择结果。
作者
lm2343635, [email protected]
许可证
MGSelector 在 MIT 许可证下可用。详细信息请参阅 LICENSE 文件。