Skip to content

Commit 927c0ac

Browse files
committed
navigationBar background color 수정
1 parent 0ed3efe commit 927c0ac

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/ios/CDVWKInAppBrowser.m

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -960,16 +960,30 @@ - (id)createNavigationViewContoller {
960960
CDVInAppBrowserNavigationController *nav = [[CDVInAppBrowserNavigationController alloc] initWithRootViewController:self];
961961
nav.orientationDelegate = self;
962962
nav.navigationBarHidden = NO;
963+
nav.modalPresentationStyle = self.modalPresentationStyle;
964+
nav.presentationController.delegate = self;
965+
966+
// navigationBar background color
967+
if (_browserOptions.toolbarcolor != nil) {
968+
if (@available(iOS 15.0, *)) {
969+
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
970+
[appearance configureWithOpaqueBackground];
971+
appearance.backgroundColor = [self colorFromHexString:_browserOptions.toolbarcolor];
972+
nav.navigationBar.standardAppearance = appearance;
973+
nav.navigationBar.scrollEdgeAppearance = appearance;
974+
}else{
975+
nav.navigationBar.barTintColor = [self colorFromHexString:_browserOptions.toolbarcolor];
976+
}
977+
}
978+
979+
// navigationBar setting
963980
nav.navigationBar.translucent = NO;
964981
UIImage *image = [UIImage new];
965982
nav.navigationBar.shadowImage = image;
966983
[nav.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
967984

968-
if (_browserOptions.toolbarcolor != nil) {
969-
nav.navigationBar.barTintColor = [self colorFromHexString:_browserOptions.toolbarcolor];
970-
}
971-
nav.modalPresentationStyle = self.modalPresentationStyle;
972-
nav.presentationController.delegate = self;
985+
nav.navigationBar.tintColor = [UIColor whiteColor];
986+
nav.navigationBar.titleTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14], NSForegroundColorAttributeName: [UIColor colorWithWhite:1.0 alpha:0.45]};
973987

974988
return nav;
975989
}
@@ -1239,22 +1253,15 @@ - (void) rePositionViews {
12391253
// [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, [self getStatusBarOffset], self.toolbar.frame.size.width, self.toolbar.frame.size.height)];
12401254
// }
12411255

1242-
self.navigationController.navigationBar.translucent = NO;
1243-
UIImage *image = [UIImage new];
1244-
self.navigationController.navigationBar.shadowImage = image;
1245-
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
1246-
if (_browserOptions.toolbarcolor != nil) {
1247-
self.navigationController.navigationBar.barTintColor = [self colorFromHexString:_browserOptions.toolbarcolor];
1248-
}
1249-
1250-
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
1256+
// navigationBar button add
12511257
UIBarButtonItem* fixedSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
12521258
fixedSpaceButton.width = 30;
12531259

12541260
self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14], NSForegroundColorAttributeName: [UIColor colorWithWhite:1.0 alpha:0.45]};
12551261
self.navigationItem.leftBarButtonItems = @[self.closeButton];
12561262
self.navigationItem.rightBarButtonItems = @[self.shareButton, self.forwardButton, fixedSpaceButton, self.backButton];
12571263

1264+
// navigationBar label add
12581265
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
12591266
label.textColor = [UIColor colorWithWhite:1.0 alpha:0.45];
12601267
label.userInteractionEnabled = YES;

0 commit comments

Comments
 (0)