我的 Apple Watch 应用程序有一个复杂功能,我想添加第二种样式。我建立了一个非常基本的原型,但在表盘上看不到它可供选择。所以我试图解决这个问题:
我的应用程序可以支持多种并发症吗?我可以在表盘上同时运行两个复杂功能吗?(或者是非此即彼的情况,如果我有一个,iOS 不会显示第二个?)我尝试添加一个新的表盘,但它不允许我。
是并发症类型的CLKComplicationTemplateModularSmallRingText
有效模板吗?ModularSmall
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
if complication.family == .modularSmall {
let template = CLKComplicationTemplateModularSmallRingText()
template.ringStyle = .open
template.fillFraction = 0.3
let testProvider = CLKSimpleTextProvider(text: "TST", shortText: "S")
sleep.tintColor = UIColor.green
template.textProvider = testProvider
template.tintColor = UIColor.green
let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
// Pass the entry to ClockKit.
handler(entry)
}
else if complication.family == .graphicRectangular {
let template = CLKComplicationTemplateGraphicRectangularLargeImage()
//this complication works...
}
占位符模板现在是相同的:
func getPlaceholderTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
// Pass the template to ClockKit.
if complication.family == .modularSmall {
let template = CLKComplicationTemplateModularSmallRingText()
//...
我在并发症占位符文件中看到一个错误(但我正在 44 毫米设备上进行测试) - 将修复它并查看发生了什么。我是否为模块化并发症返回了错误的图像或错误的模板类型?我想要一个圆环规