MKDatePicker
要求
- iOS 9.0+
- Xcode 10.0+
- Swift 5.0+
示例图
Cocoapods 安装
pod 'MKDatePicker', '~> 1.0.0'
使用
let contentView = PickerViewController()
contentView.type = type
contentView.headerView.title = NSAttributedString(string: headerTitle, attributes: [NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 16),
NSAttributedString.Key.foregroundColor: UIColor.black])
contentView.selectDate = selectDate
contentView.maximumDate = maximumDate
contentView.minimumDate = minimumDate
contentView.selectedAttributes = selectedAttributes
contentView.confirmCallBack = { (_, result) in
debugPrint(result.toString(format: dateFormatType))
}
contentView.cancelCallBack = { _ in
debugPrint("取消")
}
contentView.show()
许可
MKDatePicker遵循MIT许可。有关更多信息,请参阅LICENSE文件。