Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom elements in watchkit

I was reading Apple Watch Human Interface Guidelines and i'm curious if there is any way in displaying custom UI elements, other than those provided by default by Apple (like tables, buttons or labels). How did they managed to do this: enter image description here

Did they use images?

like image 333
Dănuț Mihai Florian Avatar asked Jan 25 '15 01:01

Dănuț Mihai Florian


1 Answers

While we haven't seen everything that Apple are doing with the core Watch OS apps, it is already clear there are many API functions that they are reserving for their own use at this stage. It's almost certain they were using some of those API functions to create these views.

There is no way to create truly custom UI elements with the current WatchKit API (i.e. entirely new custom classes doing custom drawing). That said, with some creativity, it would be possible to create most of the interface you depict with the current tools available to third party developers. This is almost certainly not the way Apple created it, but you could:

  • Create a group.
  • Put inside the group a button with a background image that represents one state of the coloured circle.
  • At runtime, visually animate the button image as needed by swapping through multiple images that rendered the various states of progress of the circle x colour options. Yes, the starting point would be thinking about 360 images for the circle states x the number of tints. (It is possible to apply a tint to a template image in WatchKit, but as far as I am aware you cannot apply a gradient.)
  • Add two labels to the group for the large number and subscript, and align both of these to be centred vertically and horizontally in the group.
  • You can set the tint of the page title at top left by setting the global tint of the application. By changing the global tint at runtime you could change these for each page.
  • It is not currently possible to change the colour of the page dots at the bottom. These are not set by the global tint and it is not possible currently to change these programatically.

Apple have indicated that later in 2015 third party developers will be able to build fully native apps, but even then, they have not given any indication of whether the API functionality available to us is broader, or whether our API will be essentially the same as it is now, with the one addition that at least some of the current WatchKit App Extension code will be able to run on the device when the iPhone is not present/charged.

like image 180
Duncan Babbage Avatar answered Oct 31 '22 17:10

Duncan Babbage