Xcode 4.6.3 でカスタム フォント ( Google Fontsから) をインストールする際に問題が発生しています。私は次のことをしています:
- Google Fonts からフォントをダウンロードする
- システム名を取得できるようにMacにインストールする
- フォント ファイル (Inconsolata.ttf) を Xcode の "Supporting Files" フォルダーにドラッグします。
- 私の
Info.Plist
ファイルに移動し、UIAppFonts 配列のアイテムとして Inconsolata.tff を追加します。 - を使用して、フォントのリストにインストールされているフォントを印刷してみてください
- Finderで見つけたカスタムフォントをフルネームで使用してみてください
ステップ 5: すべての UIFonts を出力します。
// When I search for "Inconsolata" in my Debug Console, it returns nothing
// Therefore I think that the font simply isn't being installed...
for (NSString *familyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"%@", fontName);
}
}
ステップ 6: カスタム UIFont を使用します。
// this line doesn't work.
cell.textLabel.font = [UIFont fontWithName:@"Inconsolata" size:15];
// this line works. it changes font to Helvetica-Bold
// cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15];