@@ -960,16 +960,30 @@ - (id)createNavigationViewContoller {
960
960
CDVInAppBrowserNavigationController *nav = [[CDVInAppBrowserNavigationController alloc ] initWithRootViewController: self ];
961
961
nav.orientationDelegate = self;
962
962
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
963
980
nav.navigationBar .translucent = NO ;
964
981
UIImage *image = [UIImage new ];
965
982
nav.navigationBar .shadowImage = image;
966
983
[nav.navigationBar setBackgroundImage: image forBarMetrics: UIBarMetricsDefault];
967
984
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 ]};
973
987
974
988
return nav;
975
989
}
@@ -1239,22 +1253,15 @@ - (void) rePositionViews {
1239
1253
// [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, [self getStatusBarOffset], self.toolbar.frame.size.width, self.toolbar.frame.size.height)];
1240
1254
// }
1241
1255
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
1251
1257
UIBarButtonItem* fixedSpaceButton = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemFixedSpace target: nil action: nil ];
1252
1258
fixedSpaceButton.width = 30 ;
1253
1259
1254
1260
self.navigationController .navigationBar .titleTextAttributes = @{NSFontAttributeName : [UIFont systemFontOfSize: 14 ], NSForegroundColorAttributeName : [UIColor colorWithWhite: 1.0 alpha: 0.45 ]};
1255
1261
self.navigationItem .leftBarButtonItems = @[self .closeButton];
1256
1262
self.navigationItem .rightBarButtonItems = @[self .shareButton, self .forwardButton, fixedSpaceButton, self .backButton];
1257
1263
1264
+ // navigationBar label add
1258
1265
UILabel *label = [[UILabel alloc ] initWithFrame: CGRectZero];
1259
1266
label.textColor = [UIColor colorWithWhite: 1.0 alpha: 0.45 ];
1260
1267
label.userInteractionEnabled = YES ;
0 commit comments