• <bdo id='GlwIn'></bdo><ul id='GlwIn'></ul>
    <i id='GlwIn'><tr id='GlwIn'><dt id='GlwIn'><q id='GlwIn'><span id='GlwIn'><b id='GlwIn'><form id='GlwIn'><ins id='GlwIn'></ins><ul id='GlwIn'></ul><sub id='GlwIn'></sub></form><legend id='GlwIn'></legend><bdo id='GlwIn'><pre id='GlwIn'><center id='GlwIn'></center></pre></bdo></b><th id='GlwIn'></th></span></q></dt></tr></i><div id='GlwIn'><tfoot id='GlwIn'></tfoot><dl id='GlwIn'><fieldset id='GlwIn'></fieldset></dl></div>

      <tfoot id='GlwIn'></tfoot>

      <legend id='GlwIn'><style id='GlwIn'><dir id='GlwIn'><q id='GlwIn'></q></dir></style></legend>
    1. <small id='GlwIn'></small><noframes id='GlwIn'>

        如何检查字体是否在 iOS 版本中可用?

        How to check if a font is available in version of iOS?(如何检查字体是否在 iOS 版本中可用?)

        1. <i id='atsfQ'><tr id='atsfQ'><dt id='atsfQ'><q id='atsfQ'><span id='atsfQ'><b id='atsfQ'><form id='atsfQ'><ins id='atsfQ'></ins><ul id='atsfQ'></ul><sub id='atsfQ'></sub></form><legend id='atsfQ'></legend><bdo id='atsfQ'><pre id='atsfQ'><center id='atsfQ'></center></pre></bdo></b><th id='atsfQ'></th></span></q></dt></tr></i><div id='atsfQ'><tfoot id='atsfQ'></tfoot><dl id='atsfQ'><fieldset id='atsfQ'></fieldset></dl></div>
        2. <legend id='atsfQ'><style id='atsfQ'><dir id='atsfQ'><q id='atsfQ'></q></dir></style></legend>
              <bdo id='atsfQ'></bdo><ul id='atsfQ'></ul>

                    <tbody id='atsfQ'></tbody>

                  <small id='atsfQ'></small><noframes id='atsfQ'>

                • <tfoot id='atsfQ'></tfoot>
                • 本文介绍了如何检查字体是否在 iOS 版本中可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在开发一个使用ChalkboardSE-Regular"字体的应用程序,我的部署目标是 4.0+.此字体在 4.1 中不可用,但在 4.3 中受支持.检查字体是否存在的最佳方法是什么,如果不存在,请在 <4.1 版本的 iOS 上使用另一种支持的字体.[UIFont familyName] 返回这些字体Chalkboard SE"的列表

                  I'm currently working on an app that uses the "ChalkboardSE-Regular" font and my deployment target is 4.0+. This font was not available in 4.1 but it is supported in 4.3. What would be the best way to go about checking if the font exists and if it does not, use another supported font on the <4.1 versions of iOS. [UIFont familyName] returns a list of these fonts "Chalkboard SE"

                  提前致谢!

                  T

                  推荐答案

                  [UIFont familyName] 支持回 iPhone OS 2.0(2.0 之前,iPhone 或 iPod 上不允许第三方应用touch) ,所以我会用它来检查当前设备上是否存在字体系列,如果不存在,请为该版本的 iOS 使用合适的后备字体.这是 John Gruber 的 2007 年原始 iPhone 的 iPhone 字体列表(与当时 Mac OS X 中的字体对比).我没有全部检查过,但是我检查过的 iOS 字体还在 iOS 5 中:

                  [UIFont familyName] is supported back to iPhone OS 2.0 (before 2.0, third-party apps were not allowed on iPhone or iPod touch) , so I would use that to check to see if a font family exists on the current device, and if it doesn't exist, use a suitable fall-back font for that version of iOS. Here's John Gruber's list of iPhone fonts from the original iPhone in 2007 (contrasted with the fonts in Mac OS X of the day). I haven't checked them all, but the iOS fonts I did check are still in iOS 5:

                  • http://daringfireball.net/misc/2007/07/iphone-osx字体

                  这是一个使用 [UIFont familyName] 的示例:

                  Here's an example of using [UIFont familyName]:

                  NSLog (@"Font families: %@", [UIFont familyNames]);
                  

                  这将产生一个像这样的列表:

                  This will produce a list like this:

                  字体系列:(吞武里,斯内尔圆手",学院刻 LET",......等等.

                  Font families: ( Thonburi, "Snell Roundhand", "Academy Engraved LET", ... et cetera.

                  一旦知道了系列名称,就可以使用 UIFont 类方法 fontNamesForFamilyName 来获取该系列中所有字体名称的 NSArray.例如:

                  Once you know the family name, you can use the UIFont class method fontNamesForFamilyName to get an NSArray of the names of all the fonts in the family. For example:

                  NSLog (@"Courier New family fonts: %@", [UIFont fontNamesForFamilyName:@"Courier New"]);
                  

                  这将产生一个像这样的列表:

                  That will produce a list like this:

                  Courier 新系列字体:(快递新PSMT,"CourierNewPS-BoldMT","CourierNewPS-BoldItalicMT",CourierNewPS-ItalicMT")

                  Courier New family fonts: ( CourierNewPSMT, "CourierNewPS-BoldMT", "CourierNewPS-BoldItalicMT", "CourierNewPS-ItalicMT" )

                  以下示例代码打印当前设备上每个系列中每种字体的列表:

                  The following example code prints a list of each font in every family on the current device:

                  NSArray *fontFamilies = [UIFont familyNames];
                  
                  for (int i = 0; i < [fontFamilies count]; i++)
                  {
                      NSString *fontFamily = [fontFamilies objectAtIndex:i];
                      NSArray *fontNames = [UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]];
                      NSLog (@"%@: %@", fontFamily, fontNames);
                  }
                  

                  有关详细信息,请查看 iOS 开发人员参考文档以了解 UIFont 类方法 familyNames 和 fontNamesForFamilyName:.

                  For more information, check out the iOS Developer Reference document for the UIFont class methods familyNames and fontNamesForFamilyName:.

                  这篇关于如何检查字体是否在 iOS 版本中可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What values should I use for iOS boolean states?(我应该为 iOS 布尔状态使用什么值?)
                  How do I get NSJSONSerialization to output a boolean as true or false?(如何让 NSJSONSerialization 将布尔值输出为真或假?)
                  Is there any difference between bool, Boolean, and BOOL in Objective-C?(Objective-C 中的 bool、Boolean 和 BOOL 之间有什么区别吗?)
                  Set bool property of all objects in the array(设置数组中所有对象的布尔属性)
                  What is the correct way to proceed with this bool?(处理这个布尔值的正确方法是什么?)
                  In Objective-c, safe and good way to compare 2 BOOL values?(在 Objective-c 中,比较 2 个 BOOL 值的安全和好方法?)

                  <legend id='ARrfI'><style id='ARrfI'><dir id='ARrfI'><q id='ARrfI'></q></dir></style></legend>
                    <bdo id='ARrfI'></bdo><ul id='ARrfI'></ul>
                      <i id='ARrfI'><tr id='ARrfI'><dt id='ARrfI'><q id='ARrfI'><span id='ARrfI'><b id='ARrfI'><form id='ARrfI'><ins id='ARrfI'></ins><ul id='ARrfI'></ul><sub id='ARrfI'></sub></form><legend id='ARrfI'></legend><bdo id='ARrfI'><pre id='ARrfI'><center id='ARrfI'></center></pre></bdo></b><th id='ARrfI'></th></span></q></dt></tr></i><div id='ARrfI'><tfoot id='ARrfI'></tfoot><dl id='ARrfI'><fieldset id='ARrfI'></fieldset></dl></div>
                        <tfoot id='ARrfI'></tfoot>

                        <small id='ARrfI'></small><noframes id='ARrfI'>

                            <tbody id='ARrfI'></tbody>