Discussion Forums  >  Uncategorized

Replies: 12    Views: 828

Tom Shortridge
Aspiring developer
Profile
Posts: 78
Reg: Nov 22, 2010
Virginia
1,480
03/06/11 11:19 AM (14 years ago)

Button Font - possible to change?

Working on an app for a local comics store (v1.5), using font MarkerFelt-Thin for the content text, and wanted to keep a unified look by using the same font for all the buttons as well. Anyone had any luck changing button fonts, or know where exactly I need to dig in my source code to do this? Also wondering about changing the fonts in the navigation bar - been doing research, but unable to find definitively if this is even possible. Thanks in advance for the help
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/06/11 06:03 PM (14 years ago)
For buttons, you could change the font in BT_Screens / BT_screen_menuButtons.m The font is part of a UILabel. Scroll down to about line 482 and look for: [buttonLabel setFont:[UIFont systemFontOfSize:buttonLabelFontSize]]; You could change this to something like: [buttonLabel setFont:[UIFont fontWithName:@'American Typewriter' size:14]]; I do know that not all fonts are supported on the iPhone and some will crash the device. For the navigation bar font, you'll have a much tougher time doing this. If you're using text in the bar (like the app exepects), you may run into trouble with Apple. They sometimes cringe when the font in certain places does not look like an iPhone. This is why so many apps use an image in the nav bar instead of text. Getting images in the nav bar is another thing entirely because the source-code is so dynamic. The nav bar is re-built for everyscreen and it would be tough to manage images for every screen in most cases. Not sure how to advise on this one?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/06/11 06:06 PM (14 years ago)
Looks like these will work: Font Family: American Typewriter Font: AmericanTypewriter Font: AmericanTypewriter-Bold Font Family: AppleGothic Font: AppleGothic Font Family: Arial Font: ArialMT Font: Arial-BoldMT Font: Arial-BoldItalicMT Font: Arial-ItalicMT Font Family: Arial Rounded MT Bold Font: ArialRoundedMTBold Font Family: Arial Unicode MS Font: ArialUnicodeMS Font Family: Courier Font: Courier Font: Courier-BoldOblique Font: Courier-Oblique Font: Courier-Bold Font Family: Courier New Font: CourierNewPS-BoldMT Font: CourierNewPS-ItalicMT Font: CourierNewPS-BoldItalicMT Font: CourierNewPSMT Font Family: DB LCD Temp Font: DBLCDTempBlack Font Family: Georgia Font: Georgia-Bold Font: Georgia Font: Georgia-BoldItalic Font: Georgia-Italic Font Family: Helvetica Font: Helvetica-Oblique Font: Helvetica-BoldOblique Font: Helvetica Font: Helvetica-Bold Font Family: Helvetica Neue Font: HelveticaNeue Font: HelveticaNeue-Bold Font Family: Hiragino Kaku Gothic **** W3 Font: HiraKakuProN-W3 Font Family: Hiragino Kaku Gothic **** W6 Font: HiraKakuProN-W6 Font Family: Marker Felt Font: MarkerFelt-Thin Font Family: STHeiti J Font: STHeitiJ-Medium Font: STHeitiJ-Light Font Family: STHeiti K Font: STHeitiK-Medium Font: STHeitiK-Light Font Family: STHeiti SC Font: STHeitiSC-Medium Font: STHeitiSC-Light Font Family: STHeiti TC Font: STHeitiTC-Light Font: STHeitiTC-Medium Font Family: Times New Roman Font: TimesNewRomanPSMT Font: TimesNewRomanPS-BoldMT Font: TimesNewRomanPS-BoldItalicMT Font: TimesNewRomanPS-ItalicMT Font Family: Trebuchet MS Font: TrebuchetMS-Italic Font: TrebuchetMS Font: Trebuchet-BoldItalic Font: TrebuchetMS-Bold Font Family: Verdana Font: Verdana-Bold Font: Verdana-BoldItalic Font: Verdana Font: Verdana-Italic Font Family: Zapfino Font: Zapfino I'm thinking we could get them into the control panel, and update the project to support them, without too much trouble. I can think of a few places where it would be handy for folks ;-)
 
Tom Shortridge
Aspiring developer
Profile
Posts: 78
Reg: Nov 22, 2010
Virginia
1,480
like
03/06/11 06:09 PM (14 years ago)
Muchas gracias, I'll give this a shot and report back.
 
Tom Shortridge
Aspiring developer
Profile
Posts: 78
Reg: Nov 22, 2010
Virginia
1,480
like
03/06/11 07:08 PM (14 years ago)
Ok, attempted using the code you provided and am having little luck. Entering it exactly as you have written returns an error: Expected expression before '@' token. Also 3 warnings: Character constant too long for its type, UIFont may not respond to '+fontWithName', and Warning: Multiple build commands for output file /Users/Tom/Downloads/localheroescomics-iOS-BTv15-EA884EF302B524A650238605B/build/Debug-iphonesimulator/localheroescomics.app/twitter.png (actually ignore this one, it comes up even when I'm using the original code) Taking out the @ sign allows it to build, but still get the same 3 warnings, and when I go to the More page in the app - the only button menu I'm using - no icons or text shows up and the app crashes within a second or two. Thoughts? Do I need to define some variables somewhere else or something like that? Don't mean to be a bother, and if this is distracting you from more pressing matters, I understand - it's nowhere near a necessity, just something I thought would be interesting to try and see if it works.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/06/11 09:36 PM (14 years ago)
The single quotes in [buttonLabel setFont:[UIFont fontWithName:@'American Typewriter' size:14]]; need to be double quotes, the forum doesn't allow double quotes. However, I'm surprised this caused an errror. It may, just dont' know. Try double quotes...see what happens. I just did it successfully ;-)
 
Tom Shortridge
Aspiring developer
Profile
Posts: 78
Reg: Nov 22, 2010
Virginia
1,480
like
03/07/11 07:11 AM (14 years ago)
Ah, that works beautifully. Is there a similar change I could make to the tabbed buttons?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/07/11 11:52 AM (14 years ago)
No, the layouts (image size and font size, color) are controlled by iOS - no options here without hacking your way out of the App Store ;-)
 
Tom Shortridge
Aspiring developer
Profile
Posts: 78
Reg: Nov 22, 2010
Virginia
1,480
like
03/07/11 12:02 PM (14 years ago)
Gotcha - gracias!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/07/11 12:21 PM (14 years ago)
FYI, tidbit-o-the-day In Objective-C, the iOS programming language for iOS, a data represented with words (as compared to numbers, dates, etc) is created and modified using the @ character and the data following it is surrounded by double-quotes. This data-type is knows as a String. To create an Objective-C string, the syntax is NSString *myString = @'my name is david' (as per before, single quotes are double, single on the forum) This convention is used extensively in all Objective-C programming. You'll see the @ sign all over place, dont' let it confuse you. So the above string was created and set to the value 'my name is david' and now we can work with it. To change it, we would do myString = @'my name is paul' always preceeding the value with the ampersand. Bye for now.
 
spoofer
Lost but trying
Profile
Posts: 6
Reg: Jul 13, 2011
northamptonshir...
60
like
07/23/11 03:45 PM (14 years ago)
Hi There Great tool Working on my first app Is it poss to change font in the list Menu if so how Kind Regards
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/23/11 06:51 PM (14 years ago)
Yup. The second post on this dicussions shows how to do it for a button. Same thing for a list except your not changing the button object you changing the menu item object. This is in the BT_Objects folder and it's called BT_cell_menuList.m. Add the font-change line like the second post shows around line 98 or so. You'll see where the lable and description are created.
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
02/01/12 08:42 AM (14 years ago)
Hate to drag this one up, David, but its so helpful I've bookmarked it. I need to ask a question about it, though. I am able to change the fonts for both button and list using the example above. But I haven't been able to figure out how to use the original variable 'buttonLabelFontSize' with the 'fontWithName' inclusion. You gave this example: fontWithName:@'Georgia'size:14 And I tried something like this: fontWithName:@'Georgia':buttonLabelFontSize Do I need to add the 'size:' in front? The only reason I'm trying to do this is because the change I made seems to affect both large and small device. I'm guessing if I can get the buttonLableFontSize variable back in the statement, then the font size will vary as per the settings in the Theme (am I correct?) Thanks so much!
 

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.