Skip to content

Commit

Permalink
Fix navigation bar transparent issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wlixcc committed Jul 27, 2022
1 parent b38b8d4 commit 65c93d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChartsDemo-iOS/Objective-C/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

DemoListViewController *vc = [[DemoListViewController alloc] init];
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 makeKeyAndVisible];
Expand Down
6 changes: 6 additions & 0 deletions ChartsDemo-iOS/Swift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

let vc = DemoListViewController()
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?.makeKeyAndVisible()
Expand Down

0 comments on commit 65c93d4

Please sign in to comment.