Discussion Forums  >  Uncategorized

Replies: 3    Views: 215

rpwiki
Aspiring developer
Profile
Posts: 25
Reg: Jun 03, 2011
Requa, CA
250
01/28/12 04:39 PM (14 years ago)

BT 1.5 / iOS: Nav Bar Font

I've managed to use a custom font in the nab bar. However, I noticed that the alignment seems a little off-center. It seems to have something to do with the left and right buttons. The code i've used is below (placed at around line 224 in the configureBackgroundAndNavBar method in BT_viewUtilities.m): if([[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@navBarTitleText:@] length] > 0){ UILabel *navBarLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; navBarLabel.backgroundColor=[UIColor clearColor]; navBarLabel.font=[UIFont fontWithName:@'myfontname' size:21]; navBarLabel.textColor = [UIColor whiteColor]; navBarLabel.textAlignment= UITextAlignmentCenter; navBarLabel.text=[BT_strings getJsonPropertyValue:theScreenData.jsonVars:@navBarTitleText:@]; [theViewController.navigationItem setTitleView:navBarLabel]; } Essentially, if there is a left button (or a right button) the text will appear off-center, that is, not aligned center to the screen. It looks as if the button is creating a frame and then my text frame sets right next to it. I noticed this when I added a UIImage into this. When I added the image that's when I noticed that the left button had a different background and that the image added started after the button (if this makes sense). Any help appreciated as always!
 
yp2201
Lost but trying
Profile
Posts: 52
Reg: Sep 22, 2011
Wolverhampton
1,220
like
04/15/12 10:59 AM (13 years ago)
Will this code work with BT version 2.0?
 
yp2201
Lost but trying
Profile
Posts: 52
Reg: Sep 22, 2011
Wolverhampton
1,220
like
04/15/12 11:04 AM (13 years ago)
And in eclipse for Android? Thanks, Tish.
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
04/26/12 12:52 AM (13 years ago)
Hi ripwiki. I cant get this to work? Do I have do something more?
 

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.