Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Installed & Hidden properties of WKInterfaceLabel

Tags:

watchkit

Does anybody know what is the difference between Installed & Hidden properties of WKInterfaceLabel ?

Both of them show/hide the label .

enter image description here

like image 955
Abhishek Bedi Avatar asked Jan 15 '15 09:01

Abhishek Bedi


1 Answers

For WatchKit apps, all interface elements required in an app scene have to be created in the storyboard in Xcode and installed with the app... they cannot be added programatically at runtime. The hidden attribute sets whether an element is hidden or visible at launch. This can be subsequently changed programatically, and so toggling the hidden attribute is used in a manner akin to adding or removing items from a view in iOS.

The installed attribute sets whether an interface element is installed at all in the Watch App when it is copied to the Watch. If an item is not installed, it cannot be used.

A principal way in which you might use this installed attribute is to have different interface elements on different sizes of Apple Watch. By clicking the + to the left of the Installed checkbox in Xcode, you have the option to set different values of this attribute for different Apple Watch sizes.

Xcode: select device type to install resource on

Having selected a Watch size, you can then set different values for that watch size compared to the default size:
Xcode: separate settings for multiple devices to install resource on

These changes can also be made by selecting the Apple Watch size at the bottom of the interface builder window, and making the changes directly on the storyboard. These are simply two paths to make exactly the same changes, rather than actual different alternative solutions.

Set Watch size for current storyboard editing

Note that Apple recommend that Watch app interfaces should as much as possible be the same across all Apple Watches, with interface elements varying only in size. It is possible to make these size changes for many interface elements using size constraints that set the size relative to the element's container. However, for buttons with images this is a method for installing buttons with images sized specifically for each watch.

like image 102
Duncan Babbage Avatar answered Oct 27 '22 06:10

Duncan Babbage