<tfoot id='9jqjL'></tfoot>

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

  • <small id='9jqjL'></small><noframes id='9jqjL'>

        • <bdo id='9jqjL'></bdo><ul id='9jqjL'></ul>
      1. 如何更改 UINavigationBar 标题的字体和文字颜色

        时间:2023-06-11
          • <small id='Fvsnr'></small><noframes id='Fvsnr'>

            <tfoot id='Fvsnr'></tfoot>

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

                <bdo id='Fvsnr'></bdo><ul id='Fvsnr'></ul>
                  本文介绍了如何更改 UINavigationBar 标题的字体和文字颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想把标题的字体改成 Avenir,我想把它变成白色.这是我在 viewDidLoad 方法中的代码:

                  I want to be change the font of the title to Avenir, and I want to make it white. Here is my code in the viewDidLoad method:

                  UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Avenir", size: 20)!]
                      UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
                  

                  此代码仅更改标题的颜色,而不更改字体.此外,我尝试在 App Delegate File 中实现这一点,但没有奏效.

                  This code only changes the color of the title, not the font. Additionally, I tried implementing this in the App Delegate File, but that did not work.

                  这是我的 UINavigationBar 的样子:

                  Here is what my UINavigationBar looks like:

                  我希望标题也有 Avenir 字体.我如何做到这一点?

                  I want the title to have a font of Avenir as well. How do I achieve this?

                  推荐答案

                  看来这个也是需要的:

                  self.navigationController?.navigationBar.barStyle       = UIBarStyle.Black // I then set the color using:
                  
                  self.navigationController?.navigationBar.barTintColor   = UIColor(red: 204/255, green: 47/255, blue: 40/255, alpha: 1.0) // a lovely red
                  
                  self.navigationController?.navigationBar.tintColor = UIColor.whiteColor() // for titles, buttons, etc.
                  
                  let navigationTitleFont = UIFont(name: "Avenir", size: 20)!
                  
                  self.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: navigationTitleFont]
                  

                  这篇关于如何更改 UINavigationBar 标题的字体和文字颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 UIBarButtonItem 添加到 UINav..Controller 下一篇:UINavigationController - 在所有视图中保留背景图像

                  相关文章

                  <legend id='ne6qO'><style id='ne6qO'><dir id='ne6qO'><q id='ne6qO'></q></dir></style></legend>

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

                      <tfoot id='ne6qO'></tfoot>

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

                      • <bdo id='ne6qO'></bdo><ul id='ne6qO'></ul>