Objective c Apple Clockkit-同一家族的多种并发症
作为创建复杂度的起点,可以通过实现如下所示的复杂度委托示例代码,以以下方式显示静态数据: 这种结构意味着我只能为每个并发症家族制造一个并发症。这是真的吗?我还有其他选择吗 例如,除了下面的一个,我如何创建另一个不同类型的模块化小复杂度,即CLKComplicationTemplateModularSmallStackImage,以便两者都显示在模块化小区域中 这是否可能是可以管理的用户首选项Objective c Apple Clockkit-同一家族的多种并发症,objective-c,apple-watch-complication,clockkit,Objective C,Apple Watch Complication,Clockkit,作为创建复杂度的起点,可以通过实现如下所示的复杂度委托示例代码,以以下方式显示静态数据: 这种结构意味着我只能为每个并发症家族制造一个并发症。这是真的吗?我还有其他选择吗 例如,除了下面的一个,我如何创建另一个不同类型的模块化小复杂度,即CLKComplicationTemplateModularSmallStackImage,以便两者都显示在模块化小区域中 这是否可能是可以管理的用户首选项 #pragma mark - Placeholder Templates - (void)getPla
#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);
}
}
此时,您不能为特定的家庭提供多种选择。您需要从为该系列提供的模板中选择最好的模板 对于您的特定示例,有七个不同的模块化小模板。即使你限制自己给用户两个选择,如果每个支持复杂化的应用程序在一个特定的家庭中提供的选择数量增加一倍或三倍,它也无法很好地扩展
- 用户体验视角: 它避免了破坏性的用户体验,从按应用程序滚动到按应用程序的多个选项滚动,只是为了让用户通过您的选择进入他们想要选择的不同应用程序的复杂程度
- 开发者视角: 如果用户可以选择同时显示两个或三个应用程序的不同模块化小复杂度,复杂度服务器将不得不多次调用您的特定数据源,以使您的每个活动复杂度保持最新。每天都有预算要考虑,更不用说我们的扩展变得更难阅读和维护,如果我们不得不切换家庭,然后通过特定的模板。
苹果似乎为用户和开发者选择了一个好的设计,将每个家庭的复杂度限制在一个。如果您有理由支持多个家庭,您可以向Apple Watch团队咨询。此时,您不能为特定家庭提供多种选择。您需要从为该系列提供的模板中选择最好的模板 对于您的特定示例,有七个不同的模块化小模板。即使你限制自己给用户两个选择,如果每个支持复杂化的应用程序在一个特定的家庭中提供的选择数量增加一倍或三倍,它也无法很好地扩展
- 用户体验视角: 它避免了破坏性的用户体验,从按应用程序滚动到按应用程序的多个选项滚动,只是为了让用户通过您的选择进入他们想要选择的不同应用程序的复杂程度
- 开发者视角: 如果用户可以选择同时显示两个或三个应用程序的不同模块化小复杂度,复杂度服务器将不得不多次调用您的特定数据源,以使您的每个活动复杂度保持最新。每天都有预算要考虑,更不用说我们的扩展变得更难阅读和维护,如果我们不得不切换家庭,然后通过特定的模板。