WKInterfaceDate
A label that displays the current date or time.
Declaration
class WKInterfaceDateOverview
Use WKInterfaceDate when you want to display date or time information without further interaction from your WatchKit extension. At runtime, use the date object to configure the appearance of the date and time information being displayed.
Do not subclass or create instances of this class yourself. Instead, define outlets in your interface controller class and connect them to the corresponding objects in your storyboard file. For example, to refer to a date object in your interface, define a property with the following syntax in your interface controller class:
During the initialization of your interface controller, WatchKit creates any needed date objects and assigns them to their connected outlets. After those objects are set, you can use them to make changes to the onscreen date and time information.
Interface Builder Configuration Options
Xcode lets you configure information about your date interface object in your storyboard file. The following table lists the attributes you can configure and their meaning.
Attribute | Description |
|---|---|
Format | A selector for choosing between standard and custom formats. For standard formats, you use the Date and Time attributes to configure the information you want to display. Changing the value of this attribute to Custom lets you configure the date exactly the way you want based on the format options described in 10000029i. |
Date | The date information to display. The date options correspond to the values of the Style type. |
Time | The time information to display. The time options correspond to the values of the Style type. |
Preview | A preview of what the date and time will look like. |
A date object is a custom label whose text you cannot set directly. However, you can customize the appearance of the date object as you would customize a label using the Attributes inspector in Xcode. For information about the label attributes you can configure, see WKInterfaceLabel.