无法在 WatchKit 中设置自定义字体

Not able to set custom fonts in WatchKit

我正在尝试设置 Roboto 字体并添加为手表套件扩展的目标,但它仍然是零。可以在watch kit中设置自定义字体吗

是的,您可以在 WatchKit 中使用自定义字体

https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/TextandLabels.html

它对我有用..使用以下代码。

将自定义字体添加到 WatchKit ExtensionWatchKit App 目标 Info.plist

现在你按照下面的方式编写代码,

   NSMutableAttributedString *attString =[[NSMutableAttributedString alloc]
     initWithString: @"Yano rocks! Always"];

    [attString setAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Open Sans" size:20.0]} range:NSMakeRange(0, attString.string.length)];

    [self.loadingLabel setAttributedText:attString];