• <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 导航栏透明

        时间:2023-06-12
          <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 导航栏透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Swift 重命名后退导航项 下一篇:更改 iOS 导航栏的颜色

                  相关文章

                  <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>

                    1. <tfoot id='ZAr53'></tfoot>

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