xmartlabs / XLForm

XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C.
MIT License
5.77k stars 953 forks source link

UIDatePicker Style in iOS 14 #1074

Closed Andy0570 closed 3 years ago

Andy0570 commented 3 years ago

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

colinrblake commented 3 years ago

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.

mats-claassen commented 3 years ago

This should also work if you want a wheel picker:

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

[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"

mats-claassen commented 3 years ago

Fixed in #1078