多種併發症作爲出發點,以創造併發症,靜態數據可以通過以下方式通過實施如下示例代碼的併發症代表介紹爲每個併發症家族創造一種併發症。這是真的?我還有其他選擇嗎?蘋果Clockkit爲同一家族
例如,我將如何創建另一個模塊化小複雜化,除了下面的一個,不同類型,即。 CLKComplicationTemplateModularSmallStackImage,使兩者都顯示在模塊化的小區域?
這可能是一個可以管理的用戶首選項嗎?
#pragma mark - Placeholder Templates
- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
// This method will be called once per supported complication, and the results will be cached
if (complication.family == CLKComplicationFamilyModularSmall){
CLKComplicationTemplateModularSmallStackText *template = [[CLKComplicationTemplateModularSmallStackText alloc] init];
// template.headerTextProvider = [CLKSimpleTextProvider textProviderWithText:@"Title Text"];
template.line1TextProvider = [CLKSimpleTextProvider textProviderWithText:@"TEXT1"];
template.line2TextProvider = [CLKSimpleTextProvider textProviderWithText:@"TEXT2"];
template.tintColor = [UIColor whiteColor];
handler(template);
} else if (complication.family == CLKComplicationFamilyModularLarge){
CLKComplicationTemplateModularLargeStandardBody *template = [[CLKComplicationTemplateModularLargeStandardBody alloc] init];
template.headerTextProvider = [CLKSimpleTextProvider textProviderWithText:@"Text1"];
template.body1TextProvider = [CLKSimpleTextProvider textProviderWithText:@"Text2"];
template.body2TextProvider = [CLKSimpleTextProvider textProviderWithText:@"Text3"];
UIImage *surfMain = [UIImage imageNamed:@"person"];
template.headerImageProvider = [CLKImageProvider imageProviderWithOnePieceImage:surfMain];
handler(template);
}
}