diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/Modules/TiUIWindowProxy.m b/iphone/TitaniumKit/TitaniumKit/Sources/Modules/TiUIWindowProxy.m index 1e2f321c6a1..502e9c0df05 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/Modules/TiUIWindowProxy.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/Modules/TiUIWindowProxy.m @@ -269,19 +269,26 @@ - (void)preferredContentSizeDidChangeForChildContentContainer:(id= 130000 + // TO DO: Refactor navigation bar customisation iOS 13 if ([TiUtils isIOSVersionOrGreater:@"13.0"]) { TiColor *newColor = [TiUtils colorValue:[self valueForKey:@"barColor"]]; + if (newColor == nil) { + newColor = [TiUtils colorValue:[[self tabGroup] valueForKey:@"barColor"]]; + } if (controller != nil && !(controller.edgesForExtendedLayout == UIRectEdgeTop || controller.edgesForExtendedLayout == UIRectEdgeAll)) { UINavigationBarAppearance *appearance = controller.navigationController.navigationBar.standardAppearance; - [appearance configureWithTransparentBackground]; - if (newColor == nil) { - //Get from TabGroup - newColor = [TiUtils colorValue:[[self tabGroup] valueForKey:@"barColor"]]; - } - if (newColor == nil) { - appearance.backgroundColor = self.view.backgroundColor; + if ([TiUtils boolValue:[self valueForKey:@"largeTitleEnabled"] def:NO]) { + [appearance configureWithTransparentBackground]; + if (newColor == nil) { + appearance.backgroundColor = self.view.backgroundColor; + } else { + appearance.backgroundColor = newColor.color; + } } else { - appearance.backgroundColor = newColor.color; + [appearance configureWithDefaultBackground]; + if (newColor != nil) { + appearance.backgroundColor = newColor.color; + } } controller.navigationController.navigationBar.standardAppearance = appearance; controller.navigationController.navigationBar.scrollEdgeAppearance = appearance; @@ -394,10 +401,23 @@ - (void)setTitleAttributes:(id)args } if (shouldUpdateNavBar && ([controller navigationController] != nil)) { + UINavigationBar *navigationBar = controller.navigationController.navigationBar; if ([TiUtils isIOSVersionOrGreater:@"11.0"] && [TiUtils boolValue:[self valueForKey:@"largeTitleEnabled"] def:NO]) { - [[[controller navigationController] navigationBar] setLargeTitleTextAttributes:theAttributes]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 + if ([TiUtils isIOSVersionOrGreater:@"13.0"]) { + navigationBar.standardAppearance.largeTitleTextAttributes = theAttributes; + navigationBar.scrollEdgeAppearance.largeTitleTextAttributes = theAttributes; + } +#endif + navigationBar.largeTitleTextAttributes = theAttributes; + } +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 + if ([TiUtils isIOSVersionOrGreater:@"13.0"]) { + navigationBar.standardAppearance.titleTextAttributes = theAttributes; + navigationBar.scrollEdgeAppearance.titleTextAttributes = theAttributes; } - [[[controller navigationController] navigationBar] setTitleTextAttributes:theAttributes]; +#endif + navigationBar.titleTextAttributes = theAttributes; } } @@ -417,7 +437,17 @@ - (void)updateBarImage [ourNB setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; } else { UIImage *resizableImage = [theImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0) resizingMode:UIImageResizingModeStretch]; - [ourNB setBackgroundImage:resizableImage forBarMetrics:UIBarMetricsDefault]; + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 + if ([TiUtils isIOSVersionOrGreater:@"13.0"]) { + ourNB.standardAppearance.backgroundImage = resizableImage; + ourNB.scrollEdgeAppearance.backgroundImage = resizableImage; + } +#endif + + [ourNB setBackgroundImage:resizableImage + forBarMetrics:UIBarMetricsDefault]; + //You can only set up the shadow image with a custom background image. id shadowImageValue = [self valueForUndefinedKey:@"shadowImage"]; theImage = [TiUtils toImage:shadowImageValue proxy:self];