Merge branch 'bugfix/datepicker_ios_14_style_updated' into 'develop'

date picker updated

See merge request BPHV_MIPS/mvm_core_ui!631
This commit is contained in:
Pfeil, Scott Robert 2020-11-11 13:34:59 -05:00
commit 87dd59e593
3 changed files with 17 additions and 1 deletions

View File

@ -20,6 +20,10 @@ public extension UIDatePicker {
let locale = NSLocale.current as NSLocale
datePicker.locale = locale as Locale
datePicker.calendar = locale.object(forKey: .calendar) as? Calendar
//To support old style wheel
if #available(iOS 13.4, *) {
datePicker.preferredDatePickerStyle = .wheels
}
textField.inputView = datePicker
return datePicker
@ -30,6 +34,10 @@ public extension UIDatePicker {
let datePicker = UIDatePicker()
datePicker.backgroundColor = .mvmWhite
datePicker.datePickerMode = .time
//To support old style wheel
if #available(iOS 13.4, *) {
datePicker.preferredDatePickerStyle = .wheels
}
textField.inputView = datePicker
return datePicker

View File

@ -67,7 +67,7 @@ import Foundation
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeModelsIfPresent(molecules, forKey: .molecules)
try container.encode(line, forKey: .line)
try container.encode(scrollToRowIndex, forKey: .scrollToRowIndex)
try container.encodeIfPresent(scrollToRowIndex, forKey: .scrollToRowIndex)
}
}

View File

@ -118,6 +118,10 @@ static const CGFloat VertialShadowOffset = 6;
NSLocale *locale = [NSLocale currentLocale];
datePicker.locale = locale;
datePicker.calendar = [locale objectForKey:NSLocaleCalendar];
//To handle new style in ios 13.4 and above
if (@available(iOS 13.4, *)) {
[datePicker setPreferredDatePickerStyle:UIDatePickerStyleWheels];
}
datePicker = datePicker;
textField.inputView = datePicker;
return datePicker;
@ -128,6 +132,10 @@ static const CGFloat VertialShadowOffset = 6;
datePicker.backgroundColor = [UIColor whiteColor];
datePicker.datePickerMode = UIDatePickerModeTime;
datePicker = datePicker;
//To handle new style in ios 13.4 and above
if (@available(iOS 13.4, *)) {
[datePicker setPreferredDatePickerStyle:UIDatePickerStyleWheels];
}
textField.inputView = datePicker;
return datePicker;