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

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

      1. 透明 UINavigationBar

        时间:2023-06-11

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

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

                <legend id='YSIA1'><style id='YSIA1'><dir id='YSIA1'><q id='YSIA1'></q></dir></style></legend>
                <i id='YSIA1'><tr id='YSIA1'><dt id='YSIA1'><q id='YSIA1'><span id='YSIA1'><b id='YSIA1'><form id='YSIA1'><ins id='YSIA1'></ins><ul id='YSIA1'></ul><sub id='YSIA1'></sub></form><legend id='YSIA1'></legend><bdo id='YSIA1'><pre id='YSIA1'><center id='YSIA1'></center></pre></bdo></b><th id='YSIA1'></th></span></q></dt></tr></i><div id='YSIA1'><tfoot id='YSIA1'></tfoot><dl id='YSIA1'><fieldset id='YSIA1'></fieldset></dl></div>
                    <tbody id='YSIA1'></tbody>
                • <tfoot id='YSIA1'></tfoot>
                  本文介绍了透明 UINavigationBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Am newbie to ios and I found this solution on making the UINavigationBar Transparent. Where in my project files can I put this code

                  [self.navigationBar setBackgroundImage:[UIImage new]
                                       forBarMetrics:UIBarMetricsDefault];
                  self.navigationBar.shadowImage = [UIImage new];
                  self.navigationBar.translucent = YES;
                  

                  So that it is applied in my entire project where navigation controller is being used.

                  解决方案

                  Put in your viewDidLoad function of your rootViewController this code:

                  Objective-C:

                  [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
                                       forBarMetrics:UIBarMetricsDefault];
                  self.navigationController.navigationBar.shadowImage = [UIImage new];
                  self.navigationController.navigationBar.translucent = YES;
                  self.navigationController.view.backgroundColor = [UIColor clearColor];
                  

                  Swift 2.x:

                  if let navigationBar = navigationController?.navigationBar {
                          navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
                          navigationBar.shadowImage = UIImage()
                          navigationBar.translucent = true
                          navigationController?.view.backgroundColor = .clearColor()
                      }
                  

                  Swift 3:

                  if let navigationBar = navigationController?.navigationBar {
                          navigationBar.setBackgroundImage(UIImage(), for: .default)
                          navigationBar.shadowImage = UIImage()
                          navigationBar.isTranslucent = true
                          navigationController?.view?.backgroundColor = .clear
                      }
                  

                  This works for sure! Transparent UINavigationBar.

                  这篇关于透明 UINavigationBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UINavigationController - 在所有视图中保留背景图像 下一篇:UINavigationController 和后退按钮操作

                  相关文章

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

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

                • <legend id='ELRL0'><style id='ELRL0'><dir id='ELRL0'><q id='ELRL0'></q></dir></style></legend>

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