Apple Watch的活动应用 - 画圆圈?

时间:2015-07-07 13:15:19

标签: ios objective-c swift watchkit

我想像苹果手表上的苹果活动应用程序一样绘制圆圈。研究它我发现许多人通过为每个圆圈状态提供一个图像来做到这一点。有软件可以帮助提供像这样的图像:

RadialChartImageGenerator

但是我希望通过图形转换实现这一点,例如, core graphics框架。

任何人都知道使用watchkit是否可以实现这一点?我不想要一个现成的代码解决方案,只想知道我可以使用哪些技术。非常感谢你。

2 个答案:

答案 0 :(得分:3)

您可以在此处使用多种选项。如果您希望用户能够与其进行交互,您可以使用WKInterfacePicker并定义图像序列。这将允许用户通过数字表冠滚动,您的代码将收到一个索引,您可以相应地更改图像。

在这里查看我的答案:Trying to get button to spin in WatchKit

另一种方法是在Xcode中使用所有图像构建AssetCatalog,然后设置动画到某个图像,即一定的进度百分比。 看看这篇文章:http://natashatherobot.com/watchkit-animate/

以下是类似的问题:Creating progress circle as WKInterfaceImage in Watch App

回答有关CoreGraphics的问题。我看了看watchOS2 dev。库。 (https://developer.apple.com/library/prerelease/watchos/navigation/)似乎CoreGraphics中包含了watchOS2。

答案 1 :(得分:0)

签出WKInterfaceActivityRing,自watchOS 2.2起在WatchKit中可用:

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

此外,对于iOS 9.3或更高版本,HealthKit中有HKActivityRingView

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