TLMonthYearPicker
适用于iOS应用开发的简单月份和年份选择器。现在支持Swift 5
Android版本可以在这里找到。
工作原理
self.monthYearPicker.calendar = calendar
self.monthYearPicker.monthYearPickerMode = .monthAndYear // or '.year'
self.monthYearPicker.minimumDate = self.minimumDate
self.monthYearPicker.maximumDate = self.maximumDate
self.monthYearPicker.delegate = self
//Picker delegate
func monthYearPickerView(picker: TLMonthYearPickerView, didSelectDate date: Date) {
//do your work with selected date object
}
将TLMonthYearPicker添加到您的项目
您有2种方式可以将TLMonthYearPickerView添加到您的项目中
使用CocoaPods进行安装
pod 'TLMonthYearPicker'
对于Swift 4.2,请使用版本2.0.0
pod 'TLMonthYearPicker', '3.0.0'
对于Swift 4.0,请使用版本2.0.0
pod 'TLMonthYearPicker', '2.0.0'
对于Swift 3.x,请使用版本1.0.3
pod 'TLMonthYearPicker', '1.0.3'
使用Carthage进行安装
github "lee5783/TLMonthYearPicker"
使用Swift Package Manager进行安装
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "4.1.0"))
]
手动安装
简单地将 'TLMonthYearPickerView.swift' 拖动到您的项目中。
许可证
使用受MIT许可证许可。请参阅LICENSE以了解详细信息。