DatePickerDialogSwift
一个日期、时间选择组件
Install / Use
/learn @zhenxingliu/DatePickerDialogSwiftREADME
DatePickerDialogSwift
例子
截图




代码
func datePickerTapped() {
let locale = Locale(identifier: "zh")
let currentDate = Date()
var dateComponents = DateComponents()
dateComponents.month = -3
let threeMonthAgo = Calendar.current.date(byAdding: dateComponents, to: currentDate)
dateComponents.month = 12
let nextYearMonthAgo = Calendar.current.date(byAdding: dateComponents, to: currentDate)
let datePicker = LWDatePickerDialog(textColor: .red,
buttonColor: .red,
font: UIFont.boldSystemFont(ofSize: 17),
locale:locale ,
showCancelButton: true)
datePicker.show("选择日期",
doneButtonTitle: "确定",
cancelButtonTitle: "取消",
minimumDate: threeMonthAgo,
maximumDate: nextYearMonthAgo,
datePickerMode: .date) { (date) in
if let dt = date {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
self.textField.text = formatter.string(from: dt)
}
}
}
更多使用方法可以参照:DatePickerDialog-iOS-Swift做的一些个性化改进。
要求
Swift: 4.0 iOS:10.0及以上
安装
pod 'DatePickerDialogSwift'
Author
zhenxingLiu, 5210167@qq.com
特别感谢
@Squimer的工作,我的项目就是在它的DatePickerDialog-iOS-Swift做的一些个性化改进。
License
DatePickerDialogSwift is available under the MIT license. See the LICENSE file for more info.
Related Skills
node-connect
354.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
