1.原因:
新增了一个 preferredDatePickerStyle 导致的默认UI样式变化
/// Request a style for the date picker. If the style changed, then the date picker may need to be resized and will generate a layout pass to display correctly.
@property (nonatomic, readwrite, assign) UIDatePickerStyle preferredDatePickerStyle API_AVAILABLE(ios(13.4)) API_UNAVAILABLE(tvos, watchos);
2.恢复
if (@available(iOS 14.0, *)) {
self.datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels;
//此处记得再写一下frame, 在datePickerMode设置之后
self.datePicker.frame = CGRectMake(0, 50, 290, 160);
}
本文介绍了解决iOS 13.4及以上版本中因preferredDatePickerStyle属性更新导致的默认UI样式变化问题的方法。通过设定preferredDatePickerStyle为轮播样式,并调整frame参数,可以恢复期望的日期选择器外观。
1万+

被折叠的 条评论
为什么被折叠?



