Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 74

Kingston
Aspiring developer
Profile
Posts: 118
Reg: Feb 01, 2013
New York
1,180
11/06/15 09:56 AM (8 years ago)

Changing Nav bar color to white in both iOS

Hi All, I wanted to change the nav bar color to white since it appears in black. So I did the search and tried to implement the code as suggested in https://www.buzztouch.com/forum/thread.php?tid=EB6C5D3A4681559E0533367&currentPage=3 In BT_viewController.m 'around' line 408… replace: self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeTextColor:[BT_color getColorFromHexString:[appDelegate navBarTitleTextColor]]}; with this: NSDictionary *myCustomFontType = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Didot-Italic" size:12], NSFontAttributeName,[UIColor blueColor], NSForegroundColorAttributeName,nil]; //set the title text color using the value saved in the app's delegate... [self.navigationController.navigationBar setTitleTextAttributes:myCustomFontType]; But it changes only the text color to blue and its font. All I want is to change the background color of the Nav bar to white. So I tried the below code NSDictionary *myCustomFontType = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Didot-Italic" size:12], NSFontAttributeName,[UIColor blackColor], NSBackgroundColorAttributeName,[UIColor whiteColor],nil]; But its not working. Kindly suggest me how it has to done. Thanks
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/06/15 09:32 PM (8 years ago)
Hafa Adai! Yeah, most of that is for text. If you want to setup just the 'Nav Bar' color place this at the end of the 'configureNavBar' method in your BT_viewController.m file. [self.navigationController.navigationBar setBarTintColor:[BT_color getColorFromHexString:@"#FFFFFF"]]; and of course, if later in life you want a different color, you can change "FFFFFF" to something else. Cheers! -- Smug
 
Kingston
Aspiring developer
Profile
Posts: 118
Reg: Feb 01, 2013
New York
1,180
like
11/07/15 09:47 AM (8 years ago)
Hi Smug, Thanks a lot. It works! Do you have a resolution for Android for the same?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/07/15 02:50 PM (8 years ago)
Modifying android requires modifying the 'theme' which I haven't played with much. Sorry. You can try doing something like this however: http://stackoverflow.com/questions/18288402/how-to-set-custom-actionbar-color-style Cheers! -- Smug
 

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.