I am currently trying to figure out how to change in code from iOS 13 UIDatePicker to the iOS 14 version with (.wheels
). Below you will find a screen shot of the app with the non-functioning date picker and screenshot of the code.
Unfortunately while I am able to understand Swift I am not conversant enough to know where and what changes need to be made so the code will work. I have tried some of the other solutions on here but to no avail. So if anyone could help me that would be great.
I believe I need to change the code for the dateBtnAction
, but I have no clue where the new iOS 14 code would go.
@IBAction func datePickerAction(_ sender: UIDatePicker) {
let formatter = DateFormatter()
formatter.dateFormat = "MMM dd, yyyy h:mm a"
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.amSymbol = "am"
formatter.pmSymbol = "pm"
// formatter.timeZone = TimeZone(abbreviation: "UTC")!
// formatter.dateStyle = .medium
let dateString = formatter.string(from: sender.date)
dateBtn.setTitle(dateString, for: .normal)
}
@IBAction func dateBtnAction(_ sender: Any) {
popupView(forView: datePickerContainerView, viewHeight: 300)
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…