Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
03/21/17 07:17 PM (7 years ago)

tabBarColor in iOS project appears to be tinted? - SOLVED

I'm trying to change the tabBarColor in Xcode, and I found the right place to change it in the BT_application file. But when I change it, it seems to add a tint to the existing tabBar view, but not totally change the color. For example, if I made the color #FF0000 (red), it appears pink. Black becomes gray, etc. Seems to be mixing the color requested with white. Any way to change this, or am I doing something wrong? Thanks!
 
Bonzo
Apple Fan
Profile
Posts: 780
Reg: Jan 30, 2012
Basingstoke
13,500
like
03/22/17 02:03 AM (7 years ago)
you dont have it set to transparent anywhere do you?
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
03/22/17 02:51 AM (7 years ago)
Not that I know of. There's no setting in the control panel that I see to change the style of the tab bar, and no reference of it in the iOS Xcode project. In fact, to change the color, I had to manually add the json parameter tabBarColor to the theme page since it's in the code, but not in the control panel.
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
03/24/17 03:04 PM (7 years ago)
Hey Stobe. Long time... Anyway I think Bonzo is right. The bar is translucent by default for some reason. I kinda remember fixing somewhere but kinda don't remember how or even on which app so this is only kinda helpful probably. Kinda. Tim
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
03/24/17 07:09 PM (7 years ago)
I didn't find where the view was specifically set transparent, but I found the problem! Not only that, but I added some more functionality. I know theres a plugin in the market that allows customization of the tab bar, but I've never used it. So forgive me if any of the following is redundant or old news. I fixed my problem and wanted to share. In the BT_application.m file, somewhere around line 309-ish is where the tab bar is customized. I believe it was using some old code to attempt to change the color, which is why it wasn't working. Below I will paste what I changed it to. The end result give you two new settings you can change. Neither of them are currently in the control panel, so you will have to manually add the JSON to your selected theme's JSON. The comments in the code will instruct you what to add. The two new parameters allow you to change the tab bar "tint" (background color) and the color of the tab icons. Here goes.... //customize the tab bar color... if(self.rootTheme != nil){ //currently, these two properties are not selectable in the control panel. //you have to manually add them in your selected theme's JSON //tabBarColor will set the color of the tab bar (duh!) //tabBarIconColor will set the color of the tab icons (defaults to white in this example) NSString *tabBarColor = [BT_strings getStyleValueForScreen:self.rootTheme nameOfProperty:@"tabBarColor" defaultValue:@""]; NSString *tabBarIconColor = [BT_strings getStyleValueForScreen:self.rootTheme nameOfProperty:@"tabBarIconColor" defaultValue:@"#FFFFFF"]; if([tabBarColor length] > 1){ //creates a UIColor and assigns it to the tabBar background UIColor *tmpColor = [BT_color getColorFromHexString:tabBarColor]; [[self.rootTabBarController tabBar] setBarTintColor:tmpColor]; } if([tabBarIconColor length] > 1){ //creates a UIColor and assigns it to the tabBar icons UIColor *tmpIconColor = [BT_color getColorFromHexString:tabBarIconColor]; [[self.rootTabBarController tabBar] setTintColor:tmpIconColor]; } } Let me know if you have any questions. I probably won't be able to answer them. This is the first code I've hacked in a few years, lol. -Stobe
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
03/24/17 07:11 PM (7 years ago)
the code was prettier when I copied it from Xcode. (proper code formatted tabbing sold seperately)
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
03/25/17 11:05 AM (7 years ago)
Also, add this after the setTintColor statement: [[self.rootTabBarController tabBar] setTranslucent:FALSE]; My tabBar and NavBar colors weren't matching, and this fixed it.
 

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.