Discussion Forums  >  Status Bar, Navigation Bar

Replies: 37    Views: 255

Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
04/26/12 05:22 AM (12 years ago)

Tab bar color fix!

There are many who have posted that the tab bar color do not work. I've been running with debug and saw that it skips a line in the code. You could say that it crash when it reads the line. So in BT_Objects > BT_application.m file on line 435. I uncomment this line. now it works to change the color of the tab bar. /*if([self.rootTheme.jsonVars objectForKey:@"tabBarColorOpacity"])*/ You change the color of the tab bar in your themes -> Navigation Bar / Status Bar -> Tab Bar Color
 
MacApple
Apple Fan
Profile
Posts: 4674
Reg: Oct 25, 2010
USA
61,140
like
04/26/12 05:23 AM (12 years ago)
Good eye! Will have a look this evening when I get home.
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
04/26/12 06:00 AM (12 years ago)
Thanks for that..
 
leon7000
Lost but trying
Profile
Posts: 58
Reg: Mar 02, 2012
Saudi Arabia
6,080
like
04/26/12 07:28 AM (12 years ago)
Hi when i try it i get errors ..can you clear the steps i need to make the change i was try this code on line 441: if ([rootTabBarController.tabBar respondsToSelector:@selector(setTintColor:)]) { [rootTabBarController.tabBar setTintColor:tabberColor]; } plus this : tabberColor = [UIColor greenColor]; i try it in last week but nothing change and it's always black with blue gloss and there alot of people talk about reject from apple if you change the native color but i saw alot of apps on iTunes that have custom tab bar update: i try this : /*if([self.rootTheme.jsonVars objectForKey:@"tabBarColorOpacity"])*/ { and i think i need to shutdown my laptop to void the simulator crash
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
04/26/12 07:51 AM (12 years ago)
Hi leon7000. I'm using Xcode 4.2 and have been tested on iphonesim and ipadsimulator from 4.2 to 5.0 and it works on all without warnings. Try to download a new source code if you have mix with the old one. This have a done do day! http://dl.dropbox.com/u/10431815/BT/tabbar_test.png
 
leon7000
Lost but trying
Profile
Posts: 58
Reg: Mar 02, 2012
Saudi Arabia
6,080
like
04/26/12 08:05 AM (12 years ago)
Hi Mackimack yes after reboot my laptop ...it's work fine and the color change with perfect looking ...thank you for find this it's very helpful ... :) may i ask you do you have an idea about change the blue color that come when tab the button ?
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
04/26/12 11:46 AM (12 years ago)
nice mod. great find. thank you. and nice looking app. it seems there are a few easter eggs in the BT code. a lot to wade thru, but it's proving to be very customizable if you work at it. appreciate your effort! next step is to get one reviewed with it modded. maybe that code was commented out for a reason?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
04/26/12 03:16 PM (12 years ago)
Your da man! Been racking my brains on this, went as fair trying to do hacks, this has just saved me a massive headache. On to my next head bagging puzzle!
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
04/27/12 06:20 AM (12 years ago)
Hi Mack what do you mean when you say "I uncomment this line" what to apply the fix but don't quite understand how, can you show me a before and after, then it would be much clearer for those who are new to coding, like my self.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
04/27/12 06:32 AM (12 years ago)
Hi Mack manage to sort out, you have seriously done a good deed, thank you so much!
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
05/19/12 01:41 PM (12 years ago)
Yo @Mackimack Weird, I can't get it to work on BT 2.0 on my own host. BR/Stefan
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
05/23/12 05:36 AM (12 years ago)
Hej Stefan. I have not checked through the 2.0 code. I'll check when I get the time.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
05/29/12 07:26 AM (12 years ago)
@Mackimack I was looking to modify the code you suggested this AM on my 2.0 Self Hosted and it does not exist. the BT_application.m is in the BT_Core folder on Self Hosted 2.0 but the lines in regards to the TabBarColor are not commented out. There is actually a setting in the Control Panel under the theme screen to set the tab bar color. I've tinkered with all those settings, created an used my own theme and the Default one to see if that would work. But no luck changing the tab bar color. The Nav bar setting on that same screen works like a champ, i can change that all day long. But no luck with that TAB bar color!
 
OrchardApps
Code is Art
Profile
Posts: 115
Reg: Jan 11, 2012
Brisbane austra...
5,850
like
08/13/12 04:31 AM (11 years ago)
Nul comment - thanks to PSMDanny I got it to work.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
08/13/12 06:41 AM (11 years ago)
^ nice. haven't looked at this for a bit. is that 2.0 Self Hosted you got that working on or 1.5/2.0 non hosted? I'd love to be able to adjust this...
 
OrchardApps
Code is Art
Profile
Posts: 115
Reg: Jan 11, 2012
Brisbane austra...
5,850
like
08/13/12 02:06 PM (11 years ago)
Hi ATRAIN53. I just got it to work with 1.5 non hosted. I was a bit whacky though and read it the wrong way around. Just comment out the line as first written and bang - your tab bar will appear the colour that you set it in the theme part of your app. Cheers Christine
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
08/14/12 06:26 AM (11 years ago)
gotcha. thanks. So still no solution for changing the tab colors for 2.0 yet.....
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
09/19/12 02:52 PM (11 years ago)
@ATRAIN53 .. This does work for BT 2.0. You have to actually comment out the line 435.. Works like a charm, I've done it in 1.5 and its the same for 2.0 Line 435 should look like this: /*if([self.rootTheme.jsonVars objectForKey:@"tabBarColorOpacity"])*/ { and add your color to the json or control panel and you're set.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
09/20/12 06:29 AM (11 years ago)
^^ nice. I've got an app I'd love to update with a new color if that fix works! so just commenting out that single line, and updating the Cpanel is all you did? no other code touched? Thanks for keeping me posted, I'll try to give it a quick test later and confirm.
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
09/20/12 06:33 AM (11 years ago)
i actually did it in xcode directly and no other code touched correct! but i guess it would be easiest to just edit the file directly in bt server. either way it works!
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
12/15/12 08:26 AM (11 years ago)
Which code did you change in 2.0 to get the color to change?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/17/12 10:48 AM (11 years ago)
just came across this thread - you actually don't have to change any code in 2.0. You just need to add in 2 lines to the BT_Themes json data: "BT_themes":[ { "tabBarColor":"#000000", "tabBarColorOpacity":"50" }], Of course, change the "tabBarColor" to whatever you like. You can change the Opacity percentage this way too, but 50% is the default and probably best.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 05:26 AM (11 years ago)
Hi, Came across this post. Trying to get this done. Working Android, where do I actually add these lines? Do I change this in the Configuration Data on BT server or in Eclipse and then download new source code? If in Eclipse: where can I find this file? Can't find a BT_themes json data... Thx in advance. Robin
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 06:58 AM (11 years ago)
Hi Robin-I haven't tested for Android, but if it's the same as iPhone you need to put it in your control panel, otherwise it will be overwritten as soon as you refresh.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 07:02 AM (11 years ago)
Hi Chris, So I can just add it to my Config Data in my control panel on the BT server and then how do I save the changes?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 07:21 AM (11 years ago)
Add it in the global theme under section for manually edit JSON - then hit save
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 08:22 AM (11 years ago)
Red cheeks from embarrassment ;) I think I will do something completely different for a few hours. Like running up a hill or something similar. Thx chris!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 08:25 AM (11 years ago)
Lol no biggie!
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 09:04 AM (11 years ago)
Hey Chris, I added the two lines to the json file, saved, even published changes - just to make sure - redownloaded the source code, ran it on my emulator (which NEVER seems to show what I created) and then donwloaded .apk to my Android Galaxy Advance and installed the app... no changes in the bottom toolbar color... Am I missing anything? Much obliged! Robin
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 09:15 AM (11 years ago)
I just took a look at the java files in Eclipse, and it looks like you do need to uncomment a section there for it to work. If you open the "BT_activity_root_tabs.java" file (located under the "src" folder), scroll about a third of the way down. You should see this: //sets each tabs background color... public static void setTabColor(TabHost tabhost) { /* uncomment this to change tab colors when a tab is selected... BT_debugger.showIt(activityName + ":setTabColor"); for(int i = 0; i < tabhost.getTabWidget().getChildCount(); i++){ tabhost.getTabWidget().getChildAt(i).setBackgroundColor(BT_color.getColorFromHexString("#000000")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(BT_color.getColorFromHexString("#999999")); // selected */ }
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 09:16 AM (11 years ago)
looks like it doesn't take JSON for it, so you'll have to manually enter in the hex color code in that section
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 09:27 AM (11 years ago)
thx for checking. So, just to be sure I'm doing this right: I uncommented like this: //public static void setTabColor(TabHost tabhost) { But all the follwing lines are uncommented as well. Do I need to un-uncomment them and then change both hex nrs.?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 09:28 AM (11 years ago)
try making it like this: //sets each tabs background color... public static void setTabColor(TabHost tabhost) { /* uncomment this to change tab colors when a tab is selected... */ BT_debugger.showIt(activityName + ":setTabColor"); for(int i = 0; i < tabhost.getTabWidget().getChildCount(); i++){ tabhost.getTabWidget().getChildAt(i).setBackgroundColor(BT_color.getColorFromHexString("#000000")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(BT_color.getColorFromHexString("#999999")); // selected }
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 09:30 AM (11 years ago)
Ah! Litterally uncomment THIS... learning, learning! Thx for the assist. Appreciated. Robin
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 09:49 AM (11 years ago)
Hi again, Did as you told. There's a Little red x... on line: BT_debugger.showIt(activityName + ":setTabColor"); Don't know what I need to do. And do I understand correctly that if I was to download and install a new source code. I would have to change this again (keeping a copy of this file)? Robin
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/14/13 10:41 AM (11 years ago)
Looks like the activityName variable hasn't been declared by that point. It's okay - that line is just for debugging. You can comment it out like so: //BT_debugger.showIt(activityName + ":setTabColor"); Mind you, I haven't tested this to see if it will work. But yes, you will need to do this with every source code download.
 
RobinvanKrieken
Aspiring developer
Profile
Posts: 50
Reg: Dec 20, 2012
Amsterdam
6,500
like
01/14/13 11:44 AM (11 years ago)
Cheers mate, Got it fixed. It's just that there's still a blue line (I'm guessing a blue square) behind my new colors. I'll see if I can find out how to get rid of that. Thx for now. Robin
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
02/19/13 08:58 AM (11 years ago)
Thanks Chris - ACE find and tip Finally rocking some custom colored tab bars with a couple of JSON entries :) combo with this tip: https://www.buzztouch.com/forum/thread.php?tid=707BB3BEA429E51ADF39CB2&command=isSearching&currentPage=1&topicTitle=tab&createdBy=&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory= It's perfection :) Have you looked at adding that field to the themes file for a permanant fix? again, thanks!
 

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.