/// 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);
typedef NS_ENUM(NSInteger, UIDatePickerStyle) {
/// Automatically pick the best style available for the current platform & mode.
UIDatePickerStyleAutomatic,
/// Use the wheels (UIPickerView) style. Editing occurs inline.
UIDatePickerStyleWheels,
/// Use a compact style for the date picker. Editing occurs in an overlay.
UIDatePickerStyleCompact,
/// Use a style for the date picker that allows editing in place.
UIDatePickerStyleInline API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(tvos, watchos),
} API_AVAILABLE(ios(13.4)) API_UNAVAILABLE(tvos, watchos);
可以在AppDelegate中
if (@available(iOS 13.4, *)) {
[UIDatePicker appearance].preferredDatePickerStyle = UIDatePickerStyleWheels;
}
网友评论