From 7608f8253d18794a20dd8d04cd215e0fc7c071c0 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Thu, 9 Jan 2014 15:44:21 +0100 Subject: [PATCH] Set the tintColor in the auth view and modal views navigation controller on iOS 7 - The authentication controller now sets the buttons tintColor always to the default blue color. This fixes white UIWindow tintColor, since the auth view is using white as background. - Navigation controllers for modal views now also set the tintColor of the navigationBar to the default blue color on iOS 7, if the developer did not set the `navigationBarTintColor`. This fixes white UIWindow tintColor for feedback and beta update modal views as they are defined to use the default style. --- Classes/BITAuthenticationViewController.m | 3 +++ Classes/BITHockeyBaseManager.m | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Classes/BITAuthenticationViewController.m b/Classes/BITAuthenticationViewController.m index 789c63e933..28cbf8ce41 100644 --- a/Classes/BITAuthenticationViewController.m +++ b/Classes/BITAuthenticationViewController.m @@ -122,6 +122,9 @@ buttonSize.width, buttonSize.height); button.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + if ([UIButton instancesRespondToSelector:(NSSelectorFromString(@"setTintColor:"))]) { + [button setTitleColor:BIT_RGBCOLOR(0, 122, 255) forState:UIControlStateNormal]; + } [containerView addSubview:button]; [button addTarget:self action:@selector(handleWebLoginButton:) diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index a33e66383a..76c9209963 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -196,8 +196,16 @@ - (UINavigationController *)customNavigationControllerWithRootViewController:(UIViewController *)viewController presentationStyle:(UIModalPresentationStyle)modalPresentationStyle { UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; navController.navigationBar.barStyle = self.barStyle; - if (self.navigationBarTintColor) + if (self.navigationBarTintColor) { navController.navigationBar.tintColor = self.navigationBarTintColor; + } else { + // in case of iOS 7 we overwrite the tint color on the navigation bar + if (![self isPreiOS7Environment]) { + if ([UIWindow instancesRespondToSelector:NSSelectorFromString(@"tintColor")]) { + [navController.navigationBar setTintColor:BIT_RGBCOLOR(0, 122, 255)]; + } + } + } navController.modalPresentationStyle = self.modalPresentationStyle; return navController; @@ -205,7 +213,7 @@ - (void)showView:(UIViewController *)viewController { UIViewController *parentViewController = nil; - + if ([[BITHockeyManager sharedHockeyManager].delegate respondsToSelector:@selector(viewControllerForHockeyManager:componentManager:)]) { parentViewController = [[BITHockeyManager sharedHockeyManager].delegate viewControllerForHockeyManager:[BITHockeyManager sharedHockeyManager] componentManager:self]; }