Parcourir la source

Merge pull request #4875 from wlixcc/master

Fix navigation bar transparent issue
Pierre-Marc Airoldi il y a 3 ans
Parent
commit
79cfb9adb3

+ 6 - 0
ChartsDemo-iOS/Objective-C/AppDelegate.m

@@ -24,6 +24,12 @@
     
     
     DemoListViewController *vc = [[DemoListViewController alloc] init];
     DemoListViewController *vc = [[DemoListViewController alloc] init];
     UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
     UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
+    if (@available(iOS 13.0, *)) {
+        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
+        [appearance configureWithOpaqueBackground];
+        nvc.navigationBar.standardAppearance = appearance;
+        nvc.navigationBar.scrollEdgeAppearance = appearance;
+    }
     
     
     _window.rootViewController = nvc;
     _window.rootViewController = nvc;
     [_window makeKeyAndVisible];
     [_window makeKeyAndVisible];

+ 6 - 0
ChartsDemo-iOS/Swift/AppDelegate.swift

@@ -22,6 +22,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         
         
         let vc = DemoListViewController()
         let vc = DemoListViewController()
         let nav = UINavigationController(rootViewController: vc)
         let nav = UINavigationController(rootViewController: vc)
+        if #available(iOS 13.0, *) {
+            let appearance = UINavigationBarAppearance()
+            appearance.configureWithOpaqueBackground()
+            nav.navigationBar.standardAppearance = appearance
+            nav.navigationBar.scrollEdgeAppearance = appearance
+        }
         
         
         window?.rootViewController = nav
         window?.rootViewController = nav
         window?.makeKeyAndVisible()
         window?.makeKeyAndVisible()