• <bdo id='beTCW'></bdo><ul id='beTCW'></ul>
  • <small id='beTCW'></small><noframes id='beTCW'>

      <tfoot id='beTCW'></tfoot>
      <legend id='beTCW'><style id='beTCW'><dir id='beTCW'><q id='beTCW'></q></dir></style></legend>

        <i id='beTCW'><tr id='beTCW'><dt id='beTCW'><q id='beTCW'><span id='beTCW'><b id='beTCW'><form id='beTCW'><ins id='beTCW'></ins><ul id='beTCW'></ul><sub id='beTCW'></sub></form><legend id='beTCW'></legend><bdo id='beTCW'><pre id='beTCW'><center id='beTCW'></center></pre></bdo></b><th id='beTCW'></th></span></q></dt></tr></i><div id='beTCW'><tfoot id='beTCW'></tfoot><dl id='beTCW'><fieldset id='beTCW'></fieldset></dl></div>
      1. iOS 15 导航栏透明

        iOS 15 Navigation Bar Transparent(iOS 15 导航栏透明)
          <tbody id='tBydK'></tbody>

        • <small id='tBydK'></small><noframes id='tBydK'>

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

        • <tfoot id='tBydK'></tfoot>

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

                  问题描述

                  我的 iOS 应用为 UI 使用故事板,并为导航栏的背景颜色使用自定义色调.

                  My iOS app uses the storyboard for the UI and uses a custom tint for the background color of the navigation bar.

                  我在 Xcode 13 beta 5 上测试了我的应用,导航栏是白色"的.并且导航栏上的文字不可见.

                  I have tested my app on the Xcode 13 beta 5 and the navigation bar is "white" and the text on the navigation bar is not visible.

                  在苹果开发者论坛 https://developer.apple.com/forums/thread/682420 它声明 在 iOS 15 中,UIKit 已将默认情况下会产生透明背景的 scrollEdgeAppearance 的使用扩展到所有导航栏."要恢复旧外观,您必须采用新的 UINavigationBar 外观 API

                  In the apple developer forum at https://developer.apple.com/forums/thread/682420 it states that "In iOS 15, UIKit has extended the usage of the scrollEdgeAppearance, which by default produces a transparent background, to all navigation bars." To restore the old look, you must adopt the new UINavigationBar appearance APIs

                  我将以下代码(来自上面的链接)添加到 App Delegate application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions":

                  I added the following code (from the link above) to the App Delegate "application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions":

                          if #available(iOS 13, *) {
                              let navigationController = UINavigationController(navigationBarClass: nil, toolbarClass: nil)
                              let navigationBar = navigationController.navigationBar
                              let appearance = UINavigationBarAppearance()
                              appearance.configureWithOpaqueBackground()
                              appearance.backgroundColor = UIColor(red: 0.0/255.0, green: 125/255.0, blue: 0.0/255.0, alpha: 1.0)
                              navigationBar.standardAppearance = appearance;
                              navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance
                              navigationBar.isTranslucent = false
                          }
                  

                  这并不能解决问题.我仍然在故事板编辑器中为导航栏设置了自定义色调.我需要删除自定义色调还是我实现的外观 API 错误?

                  This does not fix the problem. I still have the custom tint set in the storyboard editor for the navigation bar. Do I need to remove the custom tint or am I implementing the appearance API wrong?

                  推荐答案

                  Swift

                  // White non-transucent navigatio bar, supports dark appearance
                  if #available(iOS 15, *) {
                      let appearance = UINavigationBarAppearance()
                      appearance.configureWithOpaqueBackground()
                      UINavigationBar.appearance().standardAppearance = appearance
                      UINavigationBar.appearance().scrollEdgeAppearance = appearance
                  }
                  

                  目标-c

                  if (@available(iOS 15.0, *)) {
                      UINavigationBarAppearance *navBarAppearance = [[UINavigationBarAppearance alloc] init];
                    navBarAppearance.backgroundColor = [UIColor redColor];
                      [navBarAppearance configureWithOpaqueBackground];
                      [UINavigationBar appearance].standardAppearance = navBarAppearance;
                      [UINavigationBar appearance].scrollEdgeAppearance = navBarAppearance;
                  }
                  

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

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

                  相关文档推荐

                  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(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                    <tbody id='ZAr53'></tbody>
                  <i id='ZAr53'><tr id='ZAr53'><dt id='ZAr53'><q id='ZAr53'><span id='ZAr53'><b id='ZAr53'><form id='ZAr53'><ins id='ZAr53'></ins><ul id='ZAr53'></ul><sub id='ZAr53'></sub></form><legend id='ZAr53'></legend><bdo id='ZAr53'><pre id='ZAr53'><center id='ZAr53'></center></pre></bdo></b><th id='ZAr53'></th></span></q></dt></tr></i><div id='ZAr53'><tfoot id='ZAr53'></tfoot><dl id='ZAr53'><fieldset id='ZAr53'></fieldset></dl></div>

                    <bdo id='ZAr53'></bdo><ul id='ZAr53'></ul>
                  • <legend id='ZAr53'><style id='ZAr53'><dir id='ZAr53'><q id='ZAr53'></q></dir></style></legend>

                        • <tfoot id='ZAr53'></tfoot>

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