0

我是学习obj-c的新手。当我输入以下行时

NSLog(@"System fonts are %@", [UIFont familyNames])

我得到以下输出。

Thonburi,
"Snell Roundhand",
"Academy Engraved LET",
Avenir,
"Marker Felt",
"Geeza Pro",
"Arial Rounded MT Bold",
"Trebuchet MS",
Arial,
Marion,
"Gurmukhi MN",
"Malayalam Sangam MN",
"Bradley Hand",
"Kannada Sangam MN",
"Bodoni 72 Oldstyle",
Cochin,
"Sinhala Sangam MN",
"Hiragino Kaku Gothic ProN",
Papyrus,
Verdana,
"Zapf Dingbats",
"Avenir Next Condensed",
Courier,
"Hoefler Text",
Helvetica,
"Euphemia UCAS",
"Hiragino Mincho ProN",
"Bodoni Ornaments",
"Apple Color Emoji",
Optima,
"Gujarati Sangam MN",
"Devanagari Sangam MN",
"Times New Roman",
Kailasa,
"Telugu Sangam MN",
"Heiti SC",
"Apple SD Gothic Neo",
Futura,
"Bodoni 72",
Baskerville,
"Chalkboard SE",
"Heiti TC",
Copperplate,
"Party LET",
"American Typewriter",
Symbol,
"Avenir Next",
Noteworthy,
"Bangla Sangam MN",
Zapfino,
"Tamil Sangam MN",
Chalkduster,
"Arial Hebrew",
Georgia,
"Helvetica Neue",
"Gill Sans",
Palatino,
"Courier New",
"Oriya Sangam MN",
Didot,
"Bodoni 72 Smallcaps"

我只是想知道为什么在带有多个单词的字体名称周围有引号?

Thonburi vs "Snell Roundhand"
4

1 回答 1

2

NSLog 打印"-quotes,如果它超过一个单词,只是为了明确字符串的开始和结束位置。它应该在 NSArray 的描述方法中定义,因为它们仅在打印字符串数组时使用。感谢 omz 指出这一点。

它与字体无关:

NSArray *strings = @[@"Lorem ipsum dolor sit amet", @"gubergren"];
NSLog(@"%@", strings);
NSLog(@"%@", strings[0]);

印刷

2013-03-24 22:18:42.922 stringprinting[22876:303] (
    "Lorem ipsum dolor sit amet",
    gubergren
)
2013-03-24 22:18:42.923 stringprinting[22876:303] Lorem ipsum dolor sit amet

如果要打印不带引号的所有名称,可以单独打印每个名称

[[UIFont familyNames] enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL *stop) {
    NSLog(@"%@", obj);
}];

结果

Thonburi
Snell Roundhand
Academy Engraved LET
Avenir
Marker Felt
Geeza Pro
Arial Rounded MT Bold
…
于 2013-03-24T21:05:23.377 回答