3

我正在为我的应用程序开发手表复杂功能。该应用程序的主要功能是时间跟踪一些任务。所以对于.graphicCircular模块,我选择使用图形圆形开口量规模板。CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText. 但是,结果如下所示。倒计时不合适。

观看模拟器截图

这是我正在使用的代码:(我还没有连接我的模型。只是使用一些 UI 占位符来尝试使其首先看起来正确。)

let relativeProvider = CLKRelativeDateTextProvider(date: Date(), style: .timer, units: [.minute])
let template = CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText()
template.centerTextProvider = relativeProvider
template.bottomTextProvider = CLKSimpleTextProvider(text: "Q", shortText: "Q")
let endDate = Calendar.current.date(byAdding: .minute, value: 1, to: Date()) ?? Date()
let gaugeProvider = CLKTimeIntervalGaugeProvider(style: .fill, gaugeColors: [UIColor.green, UIColor.yellow, UIColor.orange, UIColor.red], gaugeColorLocations: nil, start: dateUsed, end: endDate)
template.gaugeProvider = gaugeProvider
return template

我还为相对日期文本提供程序尝试了不同的样式选项,但它们都不适合。

我怎样才能使这个倒计时适合?(iOS 计时器应用程序在一个圆圈内倒计时,它适合。它怎么能做到这一点?)

如果我不能使文本更小以使其适合,那么我该如何重构来自相对日期文本提供程序的文本,以便让它只显示计数?这意味着它使用 11 而不是 0:11,因此它可以适合。我知道这.offsetShort提供了11 min....不幸的是,这也不合适。我只能11 ...在屏幕上看到

任何提示表示赞赏。非常感谢你们的帮助。

4

0 回答 0