Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Watch`s Activity app - draw circles?

I want to draw circles like in apple`s activity app on apple watch. Researching about it I find that many do this by just providing an Image for each state of the circle. There is software who help to provide Images like here:

RadialChartImageGenerator

However I want to achieve this with graphic transformations, let´s say e.g. with core graphics framework.

Anyone knows if this is even possible with watchkit? I don´t want a ready-to-use code solution, just want to know which technologies I can use. Thank you very much.

like image 771
最白目 Avatar asked Sep 27 '22 09:09

最白目


2 Answers

There are several options you can use here. If you would like the users to be able to interact with it you could use a WKInterfacePicker and define an image sequence. This will let the users scroll via the digital crown and your code will receive an index and you can change images accordingly.

Check out my answer here: Trying to get button to spin in WatchKit

An other approach is to build an AssetCatalog within Xcode with all the images and then animate to a certain image i.e a certain progress percent. Look at this post: http://natashatherobot.com/watchkit-animate/

Here is a similar question aswell: Creating progress circle as WKInterfaceImage in Watch App

To answer your question about CoreGraphics. I looked at the watchOS2 dev. lib. (https://developer.apple.com/library/prerelease/watchos/navigation/) and it seems like CoreGraphics aint included in watchOS2.

like image 50
Philip Avatar answered Nov 11 '22 15:11

Philip


Check out WKInterfaceActivityRing, available in WatchKit since watchOS 2.2:

https://developer.apple.com/documentation/watchkit/wkinterfaceactivityring

Also, for iOS 9.3 or later, there is HKActivityRingView in HealthKit:

https://developer.apple.com/documentation/healthkit/hkactivityringview

like image 34
Rolleric Avatar answered Nov 11 '22 15:11

Rolleric