Post

Replies

Boosts

Views

Created

UIDatePicker not able to select current selected date, It only select when we select another date
After updating Xcode to Xcode 14 and testing in iOS 16 device . I am getting this issue it was working fine before. Now the date which is pre-selected in my case it is not triggering startDatePickerTapped function. But when we select another date it is able trigger, and then select current date after selecting another date . It is able to trigger let datePicker = UIDatePicker() datePicker.preferredDatePickerStyle = .inline datePicker.datePickerMode = .date datePicker.addTarget(self, action: #selector(startDatePickerTapped(_:)), for: .valueChanged) datePicker.minimumDate = Date()   @objc func startDatePickerTapped(_ sender: UIDatePicker?) {         startDatePickerField.text = " "         let dateFormatter = DateFormatter()         dateFormatter.dateFormat = "yyyy-MM-dd" if let date = sender?.date { startDatePickerField.text = dateFormatter.string(from: date) }         self.endEditing(true)     }
1
1
2.7k
Sep ’22