xmartlabs/XLForm

UIDatePicker Style in iOS 14

Andy0570 opened this issue · 4 comments

The style of UIDatePicker has been updated in iOS 14. How to adjust the height of the embedded UIDatePicker in XLForm?

https://static01.imgkr.com/temp/499d2e1156bd4853a647053c0c583b96.PNG

Not a fix, but a workaround to revert back to the old scroll wheel style date/time picker. In XLFormDateCell.m, around line 200 is the method *-(void)setModeToDatePicker:(UIDatePicker )datePicker. At the start of that method add the following:

    if (@available(iOS 13.4, *)) {
        datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels;
    }

Can't guarantee it'll fix all your cases, but it certainly fixed all mine.

This should also work if you want a wheel picker:

if #available(iOS 13.4, *) {
       row.cellConfigAtConfigure["datePicker.preferredDatePickerStyle"] = UIDatePickerStyle.wheels.rawValue
}

[row.cellConfigAtConfigure setObject:@(UIDatePickerStyleWheels) forKey:@"datePicker.preferredDatePickerStyle"];

I have added the above line. It does not seem to be working. I am not getting the traditional wheel picker.
It works for "XLFormRowDescriptorTypeDate" but not for "XLFormRowDescriptorTypeDateInline"

Fixed in #1078