Posts Tagged available

[iPhone] 系統內置字型清單 System Fonts Available List

chowky 當develop 的過程找到一個問題,就是的字型有何choices? 當然中文就完全沒有choice。只得一種字型。

但英文字型就有不少的choices.

這是styling 上必定會遇到的問題。

不過問題是documentation 沒有提及,所以就有developer dump 了一個清單。(當然自己都可以在Interface builder 看都可以看到的。

如果只是想改font size 就很簡單,用法是

UIFont *mainTitleFont = [UIFont boldSystemFontOfSize:14.0];
UIFont *subTitleFont = [UIFont SystemFontOfSize:14.0];
UIFont *textFont = [UIFont italicSystemFontOfSize:12.0];

如果,你的做法不只一個的呢….就要自己create 一個object 呢

UIFont *altFont = [UIFont fontWithName:@"Courier-Bold" size:14.0];

以下的coding 就是dump 所有的fonts
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@”Family name: %@”, [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@” Font name: %@”, [fontNames objectAtIndex:indFont]);
}
[fontNames release];
}
[familyNames release];

Read the rest of this entry »

  • Share/Bookmark

, , , ,

No Comments