I've written a complication for a Watch Face with Time Travel. However, i wanted the watchOS to "refresh" time line (like every hour) so that it will delete the current time line and then call getTimelineEntries again to obtain a new time line.
Is it possible? Thanks.
答案 0 :(得分:2)
有可能在当前时钟面的不同插槽中安装多个应用程序并发症,因此对于所有活动并发症,最好调用“ reloadTimelineForComplication:”。
for (CLKComplication* complication in CLKComplicationServer.sharedInstance.activeComplications)
{
//NSLog(@"Reloading Timeline for Complication: %@", complication);
[CLKComplicationServer.sharedInstance reloadTimelineForComplication:complication];
}
从文档中: CLKComplicationServer.activeComplications :此属性包含CLKComplication对象数组,每个对象代表当前显示在屏幕上的并发症版本。钟面。此数组通常没有条目,也只有一个条目,但是如果您的并发症安装在钟面上的多个插槽中,则它可能会有多个条目。
答案 1 :(得分:1)
每当您想要刷新并发症数据时,您都可以触发这样的刷新,
[[CLKComplicationServer sharedInstance] reloadTimelineForComplication:[[[CLKComplicationServer sharedInstance] activeComplications] firstObject]];
参考,您可以查看here