Discussion Forums  >  Grunts, Groans, Complaints

Replies: 16    Views: 503

AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
05/08/14 05:06 AM (9 years ago)

Setting the navbar font colour

Now that I've finally updated my iphone to IOS 7 (yes, I am a luddite)I realise the top navbar font colours for my BT apps have gone from white to black. I would like to maintain ios 6/ 7 compatibility. I can set the background colour, but I cannot see how to set the top navbar font colour. Is there a way? Also, why are ios7 title bar font colours opposite to ios6?
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/08/14 06:17 AM (9 years ago)
Hey Alan, yes there is a way, unfortunately you will have to hardcode it, so new binaries are needed for your existing apps. put this in your appDelegate: /* Nav Bar Title Text Color --------------------------------------------------------------------------- Prior to iOS 7, white was the standard color for the text in the top nav bar. White no longer works on iOS 7 because many apps are using a lighter color as the navigation bar background color. Set the nav bar text color here. */ [self setNavBarTitleTextColor:@"#FFFFFF"];
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/08/14 07:28 AM (9 years ago)
Hi Leon I did that, thanks, I can now set the navbar text in ios 6 devices to black and it comes out black on ios 7 too. So I picked a nice pale navbar background to complement that. So, the next issue - is it possible to do something similar with the nav bar left button too? I picked a pale navbar colour to complement the black navar text, now I'm getting pale button on pale background, as ther. e is no contrast between the button and the nav bar. Cheers, Alan
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/08/14 07:41 AM (9 years ago)
Getting expensive now ;-) Add the following line of code to BT_viewController.m between the //set the nav bar style... and //is the nav bar hidden... : self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/08/14 08:31 AM (9 years ago)
Hi Leon, thanks for the guidance, much appreciated. I made the change, but I didn't see any difference. To confirm, I'd like the buttons to go 'dark', to complement the text in ios 6. Cheers, Alan
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/08/14 08:37 AM (9 years ago)
yes well obviously you have to change whiteColor to blackColor or anything else then :-)
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/08/14 09:31 AM (9 years ago)
I appreciate the help Leon. When I changed it to blackColor, it made the navbar go dark again, which is what I wanted to keep light. Sadly, it isn't obvious to me at all lol. Maybe I should just be looking for a nav bar colour background that looks OK with the light icons and text on IOS 6 and also the dark on ios 7. Finding that middle ground is tricky. It feels like somebody has gone out of their way to make the contrast between navbar background and what goes on it, to be the opposite in ios 7 to how it was in ios 6. Alan
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/08/14 09:45 AM (9 years ago)
we are talking about the left button like the refresh button on the top right? Do you have the newest source code download? Just to make sure you pasted it right, it has to look like this: //set the nav bar style... if([[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"navBarStyle" defaultValue:@""] isEqualToString:@"transparent"]){ [self.navigationController.navigationBar setTranslucent:TRUE]; }else{ [self.navigationController.navigationBar setTranslucent:FALSE]; } self.navigationController.navigationBar.tintColor = [UIColor blackColor]; //is the nav bar hidden...
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/08/14 09:46 AM (9 years ago)
and the navbar color is managed in the theme section so that can be changed on the fly, so why should that change color after hardcoding the above?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/08/14 02:01 PM (9 years ago)
Hi Leon, that looks like exactly what I did. I set the navbar colour in the control panel, it shows the left button is for back, or on the home page, app refresh. On ios 6, if I used blackColor it affected the button and the navbar colour, as if it put a dark shade over everything. When I used whiteColor had no effect at all, everything looks washed out because the buttons stay pale. And all my plugins are uptodate. I suspect the design of BT here was to make the change for ios 7 because it was needed, and leave legacy ios6 the way it was, which for old apps is fine but for new apps is bad, because it make an app you are developing with a navbar difficult to look good on both.
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/08/14 02:50 PM (9 years ago)
Ah ok, well yes, that is something I didn't do until now as I assume that all users have IOS7 (why shouldn't they ;-) ). I think the app delegate has some parts for that, you should look at it. If I find something myself I will let you know.
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
05/08/14 05:33 PM (9 years ago)
I found this in the forums awhile ago. I forget who gets the credit for it but it works in my 3.0 self hosted iOS 7 For nav bar white text IN XCODE appDelegate.m line 89 change to [self setNavBarTitleTextColor:@"#FFFFFF"]; }else{ [self setNavBarTitleTextColor:@"#FFFFFF"]; } Dave
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/09/14 10:42 AM (9 years ago)
Thanks Dave, that works for the font, in the same way as LeonG's first suggestion. Not the buttons though, sadly.
 
benedettoapp
Lost but trying
Profile
Posts: 139
Reg: Jun 22, 2013
Italy
6,340
like
12/04/14 07:07 AM (9 years ago)
How would this be done for android? ( change bar text color) And is it possible to center it?
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
03/25/16 12:22 AM (8 years ago)
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
11/18/16 10:23 AM (7 years ago)
Thank you so much, Dusko! Works like a charm.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
11/18/16 10:39 AM (7 years ago)
>Thank you so much, Dusko! Works like a charm. You are welcome!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.