ios - iPhone字体问题
<p><p>我的 .ttf 文件无法在我的 iPhone 应用程序中运行。我将此文件添加到我的项目中:</p>
<pre><code>gothamnarrowbook.ttf
</code></pre>
<p>我将此添加到我的 plist 中:</p>
<pre><code><key>UIAppFonts</key>
<array>
<string>gothamnarrowbook.ttf</string>
</array>
</code></pre>
<p>在我的 ViewController 中,我添加了这个:</p>
<pre><code>UIFont *gnb = ;
</code></pre>
<p>但是 gnb 是零。我做错了什么?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>不幸的是,您在 .plist 中引用的字体的实际“名称”不一定与其文件名相同。</p>
<p>要找出字体的真名,在字体册中打开它,你应该可以看到它的真名。也许真正的名字是“Gotham Narrow Book”,或者类似的名字,Font Book 会告诉你。</p>
<p>看看这个<a href="http://kgriff.posterous.com/45359635" rel="noreferrer noopener nofollow">blog post</a>了解更多。</p>
<p>还要注意:</p>
<blockquote>
<p>Using the name from Font Book works well enough for fonts with one
variant, but if your font has multiple variants, and you don't want to
get involved with iOS's seemingly incomplete implementation of
NSAttributedString, then you'll have to specify the variant explicitly
when you load the font.</p>
<p>Using UIFont's class method +fontNamesForFamilyName: you supply the
font family name, for example "Cloister Black" which might have two
variants "Light" and "Dark", and it will return an NSArray of all
variants of that font, "CloisterBlack-Light" and "CloisterBlack-Dark".
Notice no spaces.</p>
</blockquote></p>
<p style="font-size: 20px;">关于ios - iPhone字体问题,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/8403420/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/8403420/
</a>
</p>
页:
[1]