【问题标题】:Apple Watch`s Activity app - draw circles?Apple Watch 的 Activity 应用程序 - 画圆圈?
【发布时间】:2015-07-07 13:15:19
【问题描述】:

我想在 Apple Watch 上的 Apple 活动应用中画圆圈。研究它,我发现许多人只是通过为圆圈的每个状态提供一个图像来做到这一点。有软件可以帮助提供像这里这样的图像:

RadialChartImageGenerator

但是我想通过图形转换来实现这一点,比如说使用core graphics 框架。

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

【问题讨论】:

    标签: ios objective-c swift watchkit


    【解决方案1】:

    您可以在此处使用多个选项。如果您希望用户能够与之交互,您可以使用 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 中。

    【讨论】:

      【解决方案2】:

      查看WKInterfaceActivityRing,自 watchOS 2.2 起可在 WatchKit 中使用:

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

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

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

      【讨论】:

        猜你喜欢
        • 2016-05-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-27
        相关资源
        最近更新 更多