简体   繁体   中英

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 eg 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.

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 ie 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM