From ea4f6a4f08244ee496be1136a7b41ba3148eed87 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 28 Sep 2021 15:47:22 +0800 Subject: [PATCH] iOS:Compat with iOS 15 --- doric-cli/assets-lib/example/iOS/App/SceneDelegate.m | 6 ++++++ doric-cli/assets/iOS/App/SceneDelegate.m | 6 ++++++ doric-iOS/Example/Example/AppDelegate.m | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m b/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m index 59d7fe3f..fc45d6bb 100644 --- a/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m +++ b/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m @@ -25,6 +25,12 @@ - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session op doricViewController.navigationItem.rightBarButtonItem = rightBarItem; #endif UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController]; + UINavigationBar *bar = navigationController.navigationBar; + if (@available(iOS 15.0, *)) { + UINavigationBarAppearance *barAppearance = [UINavigationBarAppearance new]; + barAppearance.backgroundColor = UIColor.whiteColor; + bar.scrollEdgeAppearance = bar.standardAppearance = barAppearance; + } UIWindow *window = [[UIWindow alloc] initWithWindowScene:windowScene]; window.frame = windowScene.coordinateSpace.bounds; window.rootViewController = navigationController; diff --git a/doric-cli/assets/iOS/App/SceneDelegate.m b/doric-cli/assets/iOS/App/SceneDelegate.m index 5e057088..d55da7c9 100644 --- a/doric-cli/assets/iOS/App/SceneDelegate.m +++ b/doric-cli/assets/iOS/App/SceneDelegate.m @@ -23,6 +23,12 @@ - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session op doricViewController.navigationItem.rightBarButtonItem = rightBarItem; #endif UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController]; + UINavigationBar *bar = navigationController.navigationBar; + if (@available(iOS 15.0, *)) { + UINavigationBarAppearance *barAppearance = [UINavigationBarAppearance new]; + barAppearance.backgroundColor = UIColor.whiteColor; + bar.scrollEdgeAppearance = bar.standardAppearance = barAppearance; + } UIWindow *window = [[UIWindow alloc] initWithWindowScene:windowScene]; window.frame = windowScene.coordinateSpace.bounds; window.rootViewController = navigationController; diff --git a/doric-iOS/Example/Example/AppDelegate.m b/doric-iOS/Example/Example/AppDelegate.m index 05514209..bdd09c36 100644 --- a/doric-iOS/Example/Example/AppDelegate.m +++ b/doric-iOS/Example/Example/AppDelegate.m @@ -47,6 +47,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( #if __has_include() [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder]; #endif + UINavigationBar *bar = self.navigationController.navigationBar; + if (@available(iOS 15.0, *)) { + UINavigationBarAppearance *barAppearance = [UINavigationBarAppearance new]; + barAppearance.backgroundColor = UIColor.whiteColor; + bar.scrollEdgeAppearance = bar.standardAppearance = barAppearance; + } return YES; }