Commit 221317a8 authored by pete谢兆麟's avatar pete谢兆麟

时间选择器细节修改

parent 09a505f3
......@@ -337,14 +337,17 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
detailItem.type == .certificateSignDate { // 届满日期 签发日期
var title = ""
var lastIsTaday = false
if detailItem.type == .certificateValidDate {
title = "选择届满日期"
lastIsTaday = false
} else if detailItem.type == .certificateSignDate {
title = "选择签发日期"
lastIsTaday = true
}
self.view?.endEditing(true)
YHDatePickView.show(type: .yyyymmdd, title: title, lastIsTaday: true) {
YHDatePickView.show(type: .yyyymmdd, title: title, lastIsTaday: lastIsTaday) {
[weak self] dateStr in
print(dateStr)
......
......@@ -42,13 +42,24 @@ class YHDatePickView: UIView {
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
case .yyyymm:
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(0, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
case .yyyy:
pickerView.selectRow(0, inComponent: 0, animated: true)
}
} else {
pickerView.selectRow(100, inComponent: 0, animated: true)
guard let type = type else { return }
switch type {
case .yyyymmdd:
pickerView.selectRow(100, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
case .yyyymm:
pickerView.selectRow(100, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
case .yyyy:
pickerView.selectRow(100, inComponent: 0, animated: true)
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment