2016-01-30 27 views
0

多種併發症作爲出發點,以創造併發症,靜態數據可以通過以下方式通過實施如下示例代碼的併發症代表介紹爲每個併發症家族創造一種併發症。這是真的?我還有其他選擇嗎?蘋果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); 
} 

} 

回答

2

此時,您無法爲特定家庭提供多種選擇。您應該選擇爲該家庭提供的最佳模板。

對於您的特定示例,有七個不同的模塊化小模板。即使你限制自己給用戶兩個選擇,如果每個支持併發症的應用程序在特定系列中提供的選擇數量增加一倍或兩倍,它也不會很好地擴展。

  • UX觀點:

    它避免了顛覆性的用戶體驗,從具有應用滾動之間過渡到通過一個應用程序的多個選擇滾動,只是爲用戶拿過去你的選擇到不同的應用程序的他們想要選擇的併發症。

  • 開發人員的角度:

    如果用戶可以選擇顯示兩個或三個在同一時間您的應用程序的不同模塊的小併發症,併發症的服務器將不得不打電話給你的特定數據源多次,只是爲了保持您的最新動態複雜功能。有每日預算需要考慮,更不用說我們的擴展程序變得有點難以閱讀和維護,如果我們必須打開家庭,然後通過特定的模板。

蘋果似乎已經爲用戶和開發者選擇了一個很好的設計,將其限制爲每個家庭一個併發症。如果您有支持多個的理由,您可以致電Apple Watch團隊submit a feature request