我使用的是iOS 9.2和7.2的Xcode蘋果Clockkit併發症不顯示佔位符數據
我看過一個偉大的視頻在這裏https://developer.apple.com/videos/play/wwdc2015-209/和發現一對夫婦的幫助信息的發展在Objective-C一些clockkit併發症。在本視頻以及文章中,聲明瞭複雜性控制器中的以下代碼是靜態/佔位符複雜性所需的全部內容。
有什麼改變,還是我錯過了更重要的東西呢?使用下面的代碼,我可以看到我選擇的複雜性,但它是空白/空白。
任何想法?我可以繼續執行其他代表,但希望能先實現這一步驟。
- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
if (complication.family == CLKComplicationFamilyCircularSmall){
CLKComplicationTemplateCircularSmallRingText *tmpl = [[CLKComplicationTemplateCircularSmallRingText alloc] init];
tmpl.textProvider = [CLKSimpleTextProvider textProviderWithText:@"Title Text"];
tmpl.fillFraction = 0.07f;
tmpl.ringStyle = CLKComplicationRingStyleClosed;
handler(tmpl);
} else if (complication.family == CLKComplicationFamilyModularLarge){
CLKComplicationTemplateModularLargeStandardBody *template = [[CLKComplicationTemplateModularLargeStandardBody alloc] init];
template.headerTextProvider = [CLKSimpleTextProvider textProviderWithText:@"Title Text"];
template.body1TextProvider = [CLKSimpleTextProvider textProviderWithText:@"Body Text"];
handler(template);
}
你有一個錯字,你在else if中重複'CLKComplicationFamilyCircularSmall',所以路徑永遠不會被執行。 –
謝謝 - 是的,只是注意到了,我將只爲完成而編輯。我剛剛意識到,默認情況下的複雜文本是黑色的!!!!!去搞清楚。因此,對黑色背景......解決方案是:template.tintColor = [UIColor whiteColor]; – MagicFlow