NSDatePickerCell Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.4 and later.
Declared in
NSDatePickerCell.h
Related sample code

Overview

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

Tasks

Configuring Appearance

Range Mode

Object Values

Date Range Constraints

Getting and Setting the Delegate

Instance Methods

backgroundColor

Returns the receiver’s background color.

- (NSColor *)backgroundColor
Return Value

The receiver’s background color.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

calendar

Returns the calendar used by the receiver.

- (NSCalendar *)calendar
Return Value

The calendar used by the receiver.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

datePickerElements

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.

- (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.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

datePickerMode

Returns the receiver’s date picker mode.

- (NSDatePickerMode)datePickerMode
Return Value

The receiver’s date picker mode.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

datePickerStyle

Returns the receiver’s date picker style.

- (NSDatePickerStyle)datePickerStyle
Return Value

The receiver’s date picker style.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

dateValue

Returns the receiver’s date.

- (NSDate *)dateValue
Return Value

The receiver’s date.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

delegate

Returns the receiver’s delegate.

- (id < NSDatePickerCellDelegate >)delegate
Return Value

The receiver’s delegate.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

drawsBackground

Returns whether the receiver draws the background.

- (BOOL)drawsBackground
Return Value

YES if the receiver draws the background, otherwise NO.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

locale

Returns the receiver’s locale.

- (NSLocale *)locale
Return Value

The receiver’s locale.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

maxDate

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

- (NSDate *)maxDate
Return Value

The maximum date value that the receiver allows as input.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

minDate

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

- (NSDate *)minDate
Return Value

The minimum date value that the receiver allows as input.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setBackgroundColor:

Sets the receiver’s background color

- (void)setBackgroundColor:(NSColor *)color
Parameters
color

The new background color.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setCalendar:

Sets the receiver’s calendar.

- (void)setCalendar:(NSCalendar *)newCalendar
Parameters
newCalendar

The calendar used by the receiver.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setDatePickerElements:

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.

- (void)setDatePickerElements:(NSDatePickerElementFlags)elementFlags
Parameters
elementFlags

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

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setDatePickerMode:

Sets the receiver’s date picker mode.

- (void)setDatePickerMode:(NSDatePickerMode)newMode
Parameters
newMode

The new date picker mode.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setDatePickerStyle:

Sets the receiver’s date picker style.

- (void)setDatePickerStyle:(NSDatePickerStyle)newStyle
Parameters
newStyle

The new date picker style.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setDateValue:

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

- (void)setDateValue:(NSDate *)newStartDate
Parameters
newStartDate

The new starting date.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setDelegate:

Sets the receiver's delegate.

- (void)setDelegate:(id < NSDatePickerCellDelegate >)anObject
Parameters
anObject

The receiver's delegate.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSDatePickerCell.h

setDrawsBackground:

Sets whether the receiver draws the background.

- (void)setDrawsBackground:(BOOL)flag
Parameters
flag

YES if the receiver draws the background, otherwise NO.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setLocale:

Sets the receiver’s locale.

- (void)setLocale:(NSLocale *)newLocale
Parameters
newLocale

The receiver’s locale.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSDatePickerCell.h

setMaxDate:

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

- (void)setMaxDate:(NSDate *)date
Parameters
date

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

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSDatePickerCell.h

setMinDate:

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

- (void)setMinDate:(NSDate *)date
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.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSDatePickerCell.h

setTextColor:

Sets the receiver’s text color.

- (void)setTextColor:(NSColor *)color
Parameters
color

The new text color.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setTimeInterval:

Sets the time interval of the date range.

- (void)setTimeInterval:(NSTimeInterval)newTimeInterval
Parameters
newTimeInterval

The time interval of the date range.

Discussion

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

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

setTimeZone:

Sets the receiver’s time zone.

- (void)setTimeZone:(NSTimeZone *)newTimeZone
Parameters
newTimeZone

The receiver’s time zone.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSDatePickerCell.h

textColor

Returns the receiver’s text color.

- (NSColor *)textColor
Return Value

The receiver’s text color.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

timeInterval

Returns the time interval that represents the date range.

- (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.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

timeZone

Returns the receiver’s time zone.

- (NSTimeZone *)timeZone
Return Value

The receiver’s time zone.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

Constants

NSDatePickerStyle

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

typedef NSUInteger NSDatePickerStyle;
Discussion

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

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

Date Picker Style

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

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

Provide a text field and stepper style interface.

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

NSClockAndCalendarDatePickerStyle

Provide a visual clock and calendar style interface.

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

NSTextFieldDatePickerStyle

Provide a text field interface.

Available in OS X v10.5 and later.

Declared in NSDatePickerCell.h.

Declared In
NSDatePickerCell.h

NSDatePickerMode

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

typedef NSUInteger NSDatePickerMode;
Discussion

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

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

Date Picker Mode

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

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

Allow selection of a single date.

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

NSRangeDateMode

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

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

Special Considerations

Prior to OS X v 10.5 only NSSingleDateMode was implemented.

Declared In
NSDatePickerCell.h

NSDatePickerElementFlags

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

typedef NSUInteger NSDatePickerElementFlags;
Discussion

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

Availability
  • Available in OS X v10.4 and later.
Declared In
NSDatePickerCell.h

Date Picker Elements

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::

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

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

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

NSHourMinuteSecondDatePickerElementFlag

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

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

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.

Declared in NSDatePickerCell.h.

NSYearMonthDatePickerElementFlag

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

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

NSYearMonthDayDatePickerElementFlag

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

Available in OS X v10.4 and later.

Declared in NSDatePickerCell.h.

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.

Declared in NSDatePickerCell.h.

Declared In
NSDatePickerCell.h