Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 157

Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
06/14/12 01:30 AM (8 years ago)

NavigationBar font color fix works only on iOS5

In BT_layout --->BT_viewUtilities.m Row 225


//sets the title text from the jsonVars
if([[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarTitleText":@""] length] > 0){
[theViewController.navigationItem setTitle:[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarTitleText":@""]];
//font color code
theViewController.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor brownColor]// forKey:UITextAttributeTextColor];
}


I have set brownColor but you can set blueColor,redColor or what you want!


If someone have a solution for Ios 4 or below . Please post a answer here!
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/20/12 11:44 AM (8 years ago)
Thanks, Mackimack. This was helpful.

Also, to change the font in the Navigation Bar, the following code works (iOS 5.0+):

//sets the title text from the jsonVars
if([[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarTitleText":@""] length] > 0){
[theViewController.navigationItem setTitle:[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarTitleText":@""]];

//font color code
theViewController.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:233.0/255.0 green:210.0/255.0 blue:149.0/255.0 alpha:1.0], UITextAttributeTextColor,
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Chalkduster" size:18], UITextAttributeFont, nil]
;
;
}
 
Black White
I hate code!
Profile
Posts: 292
Reg: Feb 22, 2012
hanoi
4,770
like
06/26/12 09:32 PM (8 years ago)
thanks, it work now
i want to change font menu list pls
how can i can do that ?
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
03/19/14 09:32 PM (7 years ago)
@MGoBlue thanks for this, I'm adding this to BT_viewUtilities.m but I'm getting an error message
'Expected identifier or '('

on the first line -

if([[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@"navBarTitleText":@""] length] > 0){

... any ideas what's going on? Your structure looks ok to me!
 

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.