Mac Developer Library

Developer

AppKit Framework Reference NSDatePickerCell Class Reference

Options
Deployment Target:

On This Page
Language:

NSDatePickerCell

An NSDatePickerCell instance controls the behavior of an NSDatePicker control, or of a single date picker cell in a matrix.

Inheritance


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.4 and later.
  • Returns the receiver’s background color.

    Declaration

    Swift

    @NSCopying var backgroundColor: NSColor

    Objective-C

    @property(copy) NSColor *backgroundColor

    Return Value

    The receiver’s background color.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver’s background color

    Declaration

    Swift

    @NSCopying var backgroundColor: NSColor

    Objective-C

    @property(copy) NSColor *backgroundColor

    Parameters

    color

    The new background color.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns whether the receiver draws the background.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Return Value

    YEStrue if the receiver draws the background, otherwise NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets whether the receiver draws the background.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Parameters

    flag

    YEStrue if the receiver draws the background, otherwise NOfalse.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns the receiver’s text color.

    Declaration

    Swift

    @NSCopying var textColor: NSColor

    Objective-C

    @property(copy) NSColor *textColor

    Return Value

    The receiver’s text color.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver’s text color.

    Declaration

    Swift

    @NSCopying var textColor: NSColor

    Objective-C

    @property(copy) NSColor *textColor

    Parameters

    color

    The new text color.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – textColor

  • Returns the receiver’s date picker style.

    Declaration

    Swift

    var datePickerStyle: NSDatePickerStyle

    Objective-C

    @property NSDatePickerStyle datePickerStyle

    Return Value

    The receiver’s date picker style.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver’s date picker style.

    Declaration

    Swift

    var datePickerStyle: NSDatePickerStyle

    Objective-C

    @property NSDatePickerStyle datePickerStyle

    Parameters

    newStyle

    The new date picker style.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns a bitmask that indicates which visual elements of the date picker are currently shown, and which won't be usable because they are hidden.

    Declaration

    Swift

    var datePickerElements: NSDatePickerElementFlags

    Objective-C

    @property NSDatePickerElementFlags datePickerElements

    Return Value

    A bitmask that specifies the date picker elements displayed by the receiver. See Constants for a description of the possible values.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets a bitmask that indicates which visual elements of the date picker are currently shown, and which won't be usable because they are hidden.

    Declaration

    Swift

    var datePickerElements: NSDatePickerElementFlags

    Objective-C

    @property NSDatePickerElementFlags datePickerElements

    Parameters

    elementFlags

    A bitmask that specifies the date picker elements displayed by the receiver. See Constants for a description of the possible values.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns the receiver’s date.

    Declaration

    Swift

    @NSCopying var dateValue: NSDate

    Objective-C

    @property(copy) NSDate *dateValue

    Return Value

    The receiver’s date.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver’s date to a new starting value.

    Declaration

    Swift

    @NSCopying var dateValue: NSDate

    Objective-C

    @property(copy) NSDate *dateValue

    Parameters

    newStartDate

    The new starting date.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – dateValue

  • Returns the time interval that represents the date range.

    Declaration

    Swift

    var timeInterval: NSTimeInterval

    Objective-C

    @property NSTimeInterval timeInterval

    Return Value

    The time interval that represents the date range.

    Discussion

    The date range begins at the date returned by dateValue. This method returns 0 when the receiver is not in the NSRangeDateMode mode.

    Special Considerations

    Prior to OS X v 10.5 this method always returned 0.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the time interval of the date range.

    Declaration

    Swift

    var timeInterval: NSTimeInterval

    Objective-C

    @property NSTimeInterval timeInterval

    Parameters

    newTimeInterval

    The time interval of the date range.

    Discussion

    The time interval only applies when the receiver is in the NSRangeDateMode mode.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns the calendar used by the receiver.

    Declaration

    Swift

    @NSCopying var calendar: NSCalendar?

    Objective-C

    @property(copy) NSCalendar *calendar

    Return Value

    The calendar used by the receiver.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver’s calendar.

    Declaration

    Swift

    @NSCopying var calendar: NSCalendar?

    Objective-C

    @property(copy) NSCalendar *calendar

    Parameters

    newCalendar

    The calendar used by the receiver.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Returns the receiver’s locale.

    Declaration

    Swift

    @NSCopying var locale: NSLocale?

    Objective-C

    @property(copy) NSLocale *locale

    Return Value

    The receiver’s locale.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – setLocale:

  • Sets the receiver’s locale.

    Declaration

    Swift

    @NSCopying var locale: NSLocale?

    Objective-C

    @property(copy) NSLocale *locale

    Parameters

    newLocale

    The receiver’s locale.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – locale

  • Returns the receiver’s time zone.

    Declaration

    Swift

    @NSCopying var timeZone: NSTimeZone?

    Objective-C

    @property(copy) NSTimeZone *timeZone

    Return Value

    The receiver’s time zone.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver’s time zone.

    Declaration

    Swift

    @NSCopying var timeZone: NSTimeZone?

    Objective-C

    @property(copy) NSTimeZone *timeZone

    Parameters

    newTimeZone

    The receiver’s time zone.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – timeZone

  • Returns the minimum date value that the receiver allows as input.

    Declaration

    Swift

    @NSCopying var minDate: NSDate?

    Objective-C

    @property(copy) NSDate *minDate

    Return Value

    The minimum date value that the receiver allows as input.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – setMinDate:

  • Sets the minimum date allowed as input by the receiver to the given date.

    Declaration

    Swift

    @NSCopying var minDate: NSDate?

    Objective-C

    @property(copy) NSDate *minDate

    Parameters

    date

    The minimum date the receiver allows as input. Pass nil to allow any date as the minimum value.

    Discussion

    Passing nil for date allows any date as the minimum value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – minDate

  • Returns the maximum date value that the receiver allows as input.

    Declaration

    Swift

    @NSCopying var maxDate: NSDate?

    Objective-C

    @property(copy) NSDate *maxDate

    Return Value

    The maximum date value that the receiver allows as input.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – setMaxDate:

  • Sets the maximum date allowed as input by the receiver to the given date.

    Declaration

    Swift

    @NSCopying var maxDate: NSDate?

    Objective-C

    @property(copy) NSDate *maxDate

    Parameters

    date

    The maximum date the receiver allows as input. Pass nil to allow any date as the maximum value.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – maxDate

  • Returns the receiver’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSDatePickerCellDelegate?

    Objective-C

    @property(assign) id<NSDatePickerCellDelegate> delegate

    Return Value

    The receiver’s delegate.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Sets the receiver's delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSDatePickerCellDelegate?

    Objective-C

    @property(assign) id<NSDatePickerCellDelegate> delegate

    Parameters

    anObject

    The receiver's delegate.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    See Also

    – delegate

Data Types

  • Specifies a type for constants that define the visual appearance of the NSDatePickerCell.

    Declaration

    Swift

    enum NSDatePickerStyle : UInt { case TextFieldAndStepperDatePickerStyle case ClockAndCalendarDatePickerStyle case TextFieldDatePickerStyle }

    Objective-C

    typedef NSUInteger NSDatePickerStyle;

    Discussion

    For a discussion of possible values, see Date Picker Style.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Specifies a type for constants that define whether the control provides a single date, or a range of dates.

    Declaration

    Swift

    enum NSDatePickerMode : UInt { case SingleDateMode case RangeDateMode }

    Objective-C

    typedef NSUInteger NSDatePickerMode;

    Discussion

    For a discussion of possible values, see Date Picker Mode.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Specifies a type for constants that allow you to specify the date and time elements that the NSDatePickerCell can edit.

    Declaration

    Swift

    struct NSDatePickerElementFlags : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var HourMinuteDatePickerElementFlag: NSDatePickerElementFlags { get } static var HourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags { get } static var TimeZoneDatePickerElementFlag: NSDatePickerElementFlags { get } static var YearMonthDatePickerElementFlag: NSDatePickerElementFlags { get } static var YearMonthDayDatePickerElementFlag: NSDatePickerElementFlags { get } static var EraDatePickerElementFlag: NSDatePickerElementFlags { get } }

    Objective-C

    typedef NSUInteger NSDatePickerElementFlags;

    Discussion

    For a discussion of possible values, see Date Picker Elements.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • The NSDatePickerStyle constants define the visual appearance of the NSDatePickerCell. These values are used by datePickerStyle and setDatePickerStyle:.

    Declaration

    Swift

    enum NSDatePickerStyle : UInt { case TextFieldAndStepperDatePickerStyle case ClockAndCalendarDatePickerStyle case TextFieldDatePickerStyle }

    Objective-C

    enum { NSTextFieldAndStepperDatePickerStyle = 0, NSClockAndCalendarDatePickerStyle = 1, NSTextFieldDatePickerStyle = 2 }; typedef NSUInteger NSDatePickerStyle;

    Constants

    • TextFieldAndStepperDatePickerStyle

      NSTextFieldAndStepperDatePickerStyle

      Provide a text field and stepper style interface.

      Available in OS X v10.4 and later.

    • ClockAndCalendarDatePickerStyle

      NSClockAndCalendarDatePickerStyle

      Provide a visual clock and calendar style interface.

      Available in OS X v10.4 and later.

    • TextFieldDatePickerStyle

      NSTextFieldDatePickerStyle

      Provide a text field interface.

      Available in OS X v10.5 and later.

    Import Statement

  • The NSDatePickerMode constants define whether the control provides a single date, or a range of dates. These values are used by datePickerMode and setDatePickerMode:.

    Declaration

    Swift

    enum NSDatePickerMode : UInt { case SingleDateMode case RangeDateMode }

    Objective-C

    enum { NSSingleDateMode = 0, NSRangeDateMode = 1 }; typedef NSUInteger NSDatePickerMode;

    Constants

    • SingleDateMode

      NSSingleDateMode

      Allow selection of a single date.

      Available in OS X v10.4 and later.

    • RangeDateMode

      NSRangeDateMode

      Allow selection of a range of dates. (First implemented in OS X v 10.5.)

      Available in OS X v10.4 and later.

    Import Statement

  • The NSDatePickerElementFlag constants allow you to specify the date and time elements that the NSDatePickerCell can edit by combining these constants using the C bitwise OR operator. These values are used by datePickerElements and setDatePickerElements::

    Declaration

    Swift

    struct NSDatePickerElementFlags : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var HourMinuteDatePickerElementFlag: NSDatePickerElementFlags { get } static var HourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags { get } static var TimeZoneDatePickerElementFlag: NSDatePickerElementFlags { get } static var YearMonthDatePickerElementFlag: NSDatePickerElementFlags { get } static var YearMonthDayDatePickerElementFlag: NSDatePickerElementFlags { get } static var EraDatePickerElementFlag: NSDatePickerElementFlags { get } }

    Objective-C

    enum { NSHourMinuteDatePickerElementFlag = 0x000c, NSHourMinuteSecondDatePickerElementFlag = 0x000e, NSTimeZoneDatePickerElementFlag = 0x0010, NSYearMonthDatePickerElementFlag = 0x00c0, NSYearMonthDayDatePickerElementFlag = 0x00e0, NSEraDatePickerElementFlag = 0x0100, }; typedef NSUInteger NSDatePickerElementFlags;

    Constants

    • HourMinuteDatePickerElementFlag

      NSHourMinuteDatePickerElementFlag

      Display and allow editing of the hour and minute elements of the date.

      Available in OS X v10.4 and later.

    • HourMinuteSecondDatePickerElementFlag

      NSHourMinuteSecondDatePickerElementFlag

      Display and allow editing of the hour, minute and second elements of the date.

      Available in OS X v10.4 and later.

    • TimeZoneDatePickerElementFlag

      NSTimeZoneDatePickerElementFlag

      Display and allow editing of the time zone.

      This flag has been declared for possible future use, and does not yet have any effect.

      Available in OS X v10.4 and later.

    • YearMonthDatePickerElementFlag

      NSYearMonthDatePickerElementFlag

      Display and allow editing of the year and month elements of the date.

      Available in OS X v10.4 and later.

    • YearMonthDayDatePickerElementFlag

      NSYearMonthDayDatePickerElementFlag

      Display and allow editing of the year, month and day elements of the date.

      Available in OS X v10.4 and later.

    • EraDatePickerElementFlag

      NSEraDatePickerElementFlag

      Display and allow editing of the era of the date, if applicable.

      This flag has been declared for possible future use, and does not yet have any effect.

      Available in OS X v10.4 and later.

    Import Statement