我的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毫米的设备上进行测试)——将修复它并查看发生了什么。我是否返回了错误的图像或错误的模板类型?我要一个圆环规