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

    1. <legend id='diPmF'><style id='diPmF'><dir id='diPmF'><q id='diPmF'></q></dir></style></legend>

        <tfoot id='diPmF'></tfoot>
      1. <small id='diPmF'></small><noframes id='diPmF'>

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

        更改 iOS 导航栏的颜色

        Change the color of iOS Navigation Bar(更改 iOS 导航栏的颜色)

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

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

            <tbody id='McmDn'></tbody>

          <tfoot id='McmDn'></tfoot>

                1. <legend id='McmDn'><style id='McmDn'><dir id='McmDn'><q id='McmDn'></q></dir></style></legend>
                  本文介绍了更改 iOS 导航栏的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试更改导航栏的颜色,但我发现只有当导航器是根时才不可能.

                  I'm trying to change the color of my navigator bar but I found that it's only impossible if the navigator is the root one.

                  我正在尝试这个:

                  self.navigationController?.navigationBar.translucent = true
                  
                  self.navigationController!.navigationBar.barTintColor = UIColor.blueColor()
                  

                  我所有的 Viewcontrollers 都与导航器控制器有关.然而,什么都没有改变.事实上,我尝试从情节提要中制作相同的东西,但只有当我在第一个导航器中时它才有效.

                  All my Viewcontrollers are related to navigator controllers. However nothing is changed. In fact I tried to make the same things from storyboard but it works only if I'm in the first navigator.

                  我试图阅读与此问题相关的所有内容,但一无所获

                  I tried to read everything related to this problem but found nothing

                  我可以像这样将任何项目添加到导航栏

                  I could add any item to the navigator bar like this

                  let HomeImage = UIImage(named: "home")!
                      let Home : UIBarButtonItem = UIBarButtonItem(image: HomeImage,  style: .Plain, target: self, action: "home:")
                      navigationItem.rightBarButtonItem = Home
                  

                  推荐答案

                  其实我发现解决方案是在AppDelegate.siwft中使用:

                  In fact, i found that the solution was to use in the AppDelegate.siwft :

                  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
                      // Override point for customization after application launch.
                      UINavigationBar.appearance().barTintColor = UIColor(red: 0, green: 0/255, blue: 205/255, alpha: 1)
                      UINavigationBar.appearance().tintColor = UIColor.whiteColor()
                      UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]
                  
                      return true
                  }
                  

                  然后在每个视图控制器中,我们需要另一种背景颜色或其他东西

                  and then in each view controller, that we need another background color or something else

                  1. segue 应该不同于show"

                  1. the segue should be different than "show"

                  使用函数viewWillAppear

                   override func viewWillAppear(animated: Bool) {
                       super.viewWillAppear(animated)
                       self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
                       self.navigationController?.navigationBar.tintColor = UIColor.blueColor()
                       self.navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.blueColor()]
                  }
                  

                  这篇关于更改 iOS 导航栏的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)
                    <legend id='lHZii'><style id='lHZii'><dir id='lHZii'><q id='lHZii'></q></dir></style></legend>
                      • <tfoot id='lHZii'></tfoot>
                        <i id='lHZii'><tr id='lHZii'><dt id='lHZii'><q id='lHZii'><span id='lHZii'><b id='lHZii'><form id='lHZii'><ins id='lHZii'></ins><ul id='lHZii'></ul><sub id='lHZii'></sub></form><legend id='lHZii'></legend><bdo id='lHZii'><pre id='lHZii'><center id='lHZii'></center></pre></bdo></b><th id='lHZii'></th></span></q></dt></tr></i><div id='lHZii'><tfoot id='lHZii'></tfoot><dl id='lHZii'><fieldset id='lHZii'></fieldset></dl></div>
                          <bdo id='lHZii'></bdo><ul id='lHZii'></ul>

                          1. <small id='lHZii'></small><noframes id='lHZii'>

                              <tbody id='lHZii'></tbody>