An object that provides information that is common to all interface objects in your watchOS app.
- watchOS 2.0+
Your WatchKit extension uses interface objects to manipulate the visual elements displayed on Apple Watch. Specifically, you use the methods of this class to change the size, alignment, and visibility of those elements. You can also configure the accessibility information displayed through assistive technologies like VoiceOver.
Do not subclass or create instances of this class, or any of its subclasses, 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 button in your interface, define a property with the following syntax in your interface controller class:
At runtime, WatchKit creates the appropriate interface objects and assigns them to the outlets in your interface controller.
WatchKit provides one-way communication between the interface objects in your extension and the corresponding interface elements in your watchOS app. You can set the values of an interface object, but you cannot get the current values. If you want to know the current value of an attribute, you must save the value yourself.
Interface Builder Configuration Options
Xcode lets you configure information about your group interface object in your storyboard file. Table 1 lists the attributes you can configure in your storyboard and their meaning.
The opacity of the object. A value of
A checkbox indicating whether the item is hidden initially. You can change the visibility of the item programmatically by calling the
A checkbox indicating whether the item is installed for the current device.
The horizontal alignment of the item. Use this attribute to configure the horizontal position of the item relative to its immediate parent.
The vertical alignment of the item. Use this attribute to configure the vertical position of the item relative to its immediate parent.
The width of the object. Specify a fixed width or set the value of the object to be a percentage of its container’s width.
The height of the object. Specify a fixed height or set the value of the object to be a percentage of its container’s height.