watchOS Complication Extra Large Text
Extra Large Text
4種類
- CLKComplicationTemplateExtraLargeColumnsText
- CLKComplicationTemplateExtraLargeRingText
- CLKComplicationTemplateExtraLargeSimpleText
- CLKComplicationTemplateExtraLargeStackText
CLKComplicationTemplateExtraLargeColumnsText
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .extraLarge: let textR1C1Provider = CLKSimpleTextProvider(text: "11") let textR1C2Provider = CLKSimpleTextProvider(text: "12") let textR2C1Provider = CLKSimpleTextProvider(text: "21") let textR2C2Provider = CLKSimpleTextProvider(text: "22") let extraLargeTemplate = CLKComplicationTemplateExtraLargeColumnsText() extraLargeTemplate.column2Alignment = .leading extraLargeTemplate.highlightColumn2 = false extraLargeTemplate.row1Column1TextProvider = textR1C1Provider extraLargeTemplate.row1Column2TextProvider = textR1C2Provider extraLargeTemplate.row2Column1TextProvider = textR2C1Provider extraLargeTemplate.row2Column2TextProvider = textR2C2Provider let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: extraLargeTemplate) handler(entry) default: handler(nil) } }
column2Alignment = .leading、highlightColumn2 = false
column2Alignment = .trailing、highlightColumn2 = true
CLKComplicationTemplateExtraLargeRingText
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .extraLarge: let textProvider = CLKSimpleTextProvider(text: "Text") let extraLargeTemplate = CLKComplicationTemplateExtraLargeRingText() extraLargeTemplate.ringStyle = .open extraLargeTemplate.fillFraction = 0.7 extraLargeTemplate.textProvider = textProvider let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: extraLargeTemplate) handler(entry) default: handler(nil) } }
CLKComplicationTemplateExtraLargeSimpleText
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .extraLarge: let textProvider = CLKSimpleTextProvider(text: "Text") let extraLargeTemplate = CLKComplicationTemplateExtraLargeSimpleText() extraLargeTemplate.textProvider = textProvider let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: extraLargeTemplate) handler(entry) default: handler(nil) } }
CLKComplicationTemplateExtraLargeStackText
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .extraLarge: let textLine1Provider = CLKSimpleTextProvider(text: "Text") let textLine2Provider = CLKSimpleTextProvider(text: "xyz") let extraLargeTemplate = CLKComplicationTemplateExtraLargeStackText() extraLargeTemplate.highlightLine2 = false extraLargeTemplate.line1TextProvider = textLine1Provider extraLargeTemplate.line2TextProvider = textLine2Provider let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: extraLargeTemplate) handler(entry) default: handler(nil) } }