Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 18    Views: 141

mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
06/08/13 04:24 PM (12 years ago)

theRefreshButtonItem color code

Hi guys, Been digging through BT_ViewUtilities, and searching for the code that makes the refresh button color based on the theme/navigation bar color. IE: If you make the navigation bar color red, the refresh button turns a dim red on the homescreen. That's the code I'm looking for. Found on line 311: if([theScreenData isHomeScreen]){ UIBarButtonItem *theRefreshButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:appDelegate action:@selector(downloadAppData)]; [theViewController.navigationItem setLeftBarButtonItem:theRefreshButtonItem]; [theRefreshButtonItem release]; } ------------------------------------------------ But nothing there references what determines that refresh button color. Trying to find other instances but so far no luck. Can anyone direct me to the correct file? Cheers! David https://buzztouchmods.com
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/08/13 04:45 PM (12 years ago)
I think it probably inherits from the navbar. There should be a tintcolor or backgroundcolor property on the button though that you can add in.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/08/13 04:48 PM (12 years ago)
That's what I thought too, but there's nothing pointing to how it "inherits". I'm modifying some code for a button using UIColor, and would like to replace it to do the same thing as the refresh button. Thanks, still looking into this, if I figure it out I will post here. Cheers, David https://buzztouchmods.com
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/08/13 04:48 PM (12 years ago)
Hmm... I'm not sure if this is what you want or not, but... Just underneath the line (313?) that states [theViewController.navigationItem setLeftBarButtonItem:theRefreshButtonItem]; Add this: [theRefreshButtonItem setTintColor:[UIColor redColor]]; And watch your refresh button turn an obnoxiously red color. Cheers! -- Smug
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/08/13 04:49 PM (12 years ago)
Yep - that's what I thought - set the tintcolor property.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/08/13 04:49 PM (12 years ago)
@Smug LOL, obnoxious red. See last post, I'm attempting to mimic the refresh buttons inheriting of the navigational button :) Cheers, David https://buzztouchmods.com
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/08/13 04:51 PM (12 years ago)
oh oh oh. gotcha. Cheers! -- Smug Maybe around line 477/570 of BT_application.m
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/08/13 04:52 PM (12 years ago)
So you need to get the tintColor of the navigationBar and set the backgroundColor of your custom UIButton to that?
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/08/13 04:52 PM (12 years ago)
@Kittsy might know what I'm attempting since I'm modifying his code. I rather not be limited to the UIColor method for this instance of the button, so rather than converting hexadecimals, I rather just have the button grab the property of the navigational bar instead. Cheers, David https://buzztouchmods.com
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/08/13 04:53 PM (12 years ago)
@Chris Exactly! Cheers, David https://buzztouchmods.com
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/08/13 04:56 PM (12 years ago)
If you change line 477 and 570 (for tabbed apps) to something similar to this: [[rootNavController navigationBar] setTintColor:[UIColor redColor]]; [[thisTabsNavController navigationBar] setTintColor:[UIColor redColor]]; The whole menu bar turns an obnoxiously red color. Cheers! -- Smug [BT_viewUtilities getNavBarBackgroundColorForScreen:theScreen]
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/08/13 04:58 PM (12 years ago)
It only seems like I don't understand because I didn't. ;) But if you're looking to 'match' colors with the menu bar, then something like setTintColor:[BT_viewUtilities getNavBarBackgroundColorForScreen:theScreen] is probably what you'll end up doing. Cheers! -- Smug
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/08/13 05:08 PM (12 years ago)
@Smug totally going to hack this up and see if your code will work here. Thanks a ton, this will help with "auto" customizing my screens with different app-themes much easier. Very cool. Thanks again to both. Cheers, David https://buzztouchmods.com
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/08/13 05:09 PM (12 years ago)
No problem!
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
06/08/13 11:59 PM (12 years ago)
Sorry for joining the party late, The favourites button is created in a similar way to the Scringo one in a "singleton" so you don't have to manually add reams and reams of code for each screen, obviously that favourites button won't suit everyone's needs and desires but it can be changed to whatever you want in that singleton, or you can manually create your own for each screen and just call the method. Your email found it's way into my spam so will email you more precise instructions.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
06/09/13 01:06 AM (12 years ago)
right I've just read the important bit your looking at. A tint is adding a colour over something. If you don't want a tint remove the line of code that says or comment it out [mybutton setTintColor:[UIColor redColor]; //[mybutton setTintColor:[UIColor redColor]; or [mybutton setTintColor:nil]; Try not to overcomplicate to much guys lol
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
06/09/13 04:29 AM (12 years ago)
Sweet thread. Nice code snippet Kittsy!
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/09/13 06:08 AM (12 years ago)
Thanks guys. @Kittsy gave me some better code via email: add #import BT_color [favouritesAddButton setTintColor:[BT_color getColorFromHexString:@"#0000FF"]]; I was using a method a little more complicated: [favouritesAddButton setTintColor:[UIColor colorWithRed:0.125 green:0.682 blue:0.137 alpha:1.0]]; I was taking the RGB values of a hex and converting them by dividing by 255 and using the last 3 values after 0. Essentially the same method but a hundred times more annoying. LOL. My method would be good if you were for some reason unable to import BT_Color. Sigh. Thanks again guys! David https://buzztouchmods.com
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
06/09/13 06:35 AM (12 years ago)
Buzztouch gives us the tools let's use them
 

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.