美文网首页
UIDatePicker样式修改

UIDatePicker样式修改

作者: QYCD | 来源:发表于2021-12-02 12:02 被阅读0次
/// 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;
    }

相关文章

网友评论

      本文标题:UIDatePicker样式修改

      本文链接:https://www.haomeiwen.com/subject/hjuyxrtx.html