Which font is used by [UIFont systemFontOfSize:15]? - iphone

I'd like to use a UIWebView with the same typographical appearance as the rest of my app texts which all use [UIFont systemFontOfSize:15]. But before doing some forensic research maybe someone knows what font that really is?

You should be able to inspect the fontName property of the UIFont returned by [UIFont systemFontOfSize:15].
NSString *fontName = [UIFont systemFontOfSize:15].fontName;

Mostly HelveticaNeueInterface-Regular (iOS7+)

Related

Custom UINavigationBar Font not displaying

My custom TrueType font file that I brought into Xcode is not displaying correctly in the UINavigationBar. Instead of displaying the custom font, it displays the System font (Helvetica Bold).
RootViewController.m
self.title = #"Library";
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIFont fontWithName:#"adellebasic_bold.ttf" size:20.0], UITextAttributeFont,nil]];
I have also made sure that I copied it into Xcode correctly and I declared it under UIAppFonts in the Info.plist file. Also note that the code works if I set it to a UIFont that is included in the iPhone SDK but not a custom font brought in.
Does anyone have the slightest idea for what I'm doing wrong here?
Try this:
NSMutableDictionary *titleBarAttributes = [NSMutableDictionary dictionaryWithDictionary: [[UINavigationBar appearance] titleTextAttributes]];
[titleBarAttributes setValue:[UIFont fontWithName:#"adellebasic_bold" size:25.0f] forKey:UITextAttributeFont];
[self.navigationController.navigationBar setTitleTextAttributes:titleBarAttributes];
[self.navigationController.navigationBar setTitleVerticalPositionAdjustment:4.0f forBarMetrics:UIBarMetricsDefault];
Hope this helps.
actually the font file name and the font name are two different things.
Check This: iOS: How can i set a non system font family, style, size of UILabel? .
Try this name "Adelle Basic Bold".

UILabel font switches back after unselecting text

I have a problem: I want to change the font in my UILabel. When I select the text in the UILabel and I change the font it works, but when I unselect the text, the font comes back to defaut.
Someone have an idea?
Thx
Are you doing it in interface builder? It is very straight forward though. You can also do that using code.
lblName.font= [UIFont fontWithName:#"Arial" size:15];
Something like this.
UIFont *myFont = [ UIFont fontWithName: #"Arial" size: 18.0 ];
textLabel.font = myFont;
This should change the font, however Are you changing it in IB? Also it depends on the type of font you are selecting. It may not be visible in IB and rendering on device depends on the fonts available on it.
labelName.font=[UIFont boldSystemFontOfSize:18]; or any other font style can be assigned as desired.

changing font size of UIButton

I have a UIButton which displays a text, with the following code:
[button setTitle:#"Join this group" forState:UIControlStateNormal];
however, how do I change the font size for this?
I tried
button.titleLabel.font = [UIFont fontWithName:#"Arial-MT" size:8.0];
but I think it's a totally different thing.
Or at least how do I make the text to adjust to the size of the button frame.
Should I just use textLabel.text instead?
The reason that the code you're posting isn't working is probably because Arial isn't present in iOS. You can change the properties of a UIButton's titleLabel just like any other instance of UILabel. Read about that here.
So, you can change the font size with something like:
button.titleLabel.font = [UIFont systemFontOfSize:14.0];
You can choose a font by name, but not all fonts are available on iOS. Here's a list of ones that are.

How can i change the text color in a UISegmented Control in iPhone app?

The only solution that i can think of so far is by adding images.. but i want the right solution...so i there any way to change the text/title color???
use this method, it is in ios 5.x
UIFont *Boldfont = [UIFont systemFontOfSize:13.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:Boldfont,UITextAttributeFont,[UIColor darkTextColor],UITextAttributeTextColor,nil];
[self.mSegmentControl setTitleTextAttributes:attributes
forState:UIControlStateNormal];
http://www.framewreck.net/2010/07/custom-tintcolor-for-each-segment-of.html
On this post there is the implementation of a category that does what you are looking for.
From iOS SDK, there is no method to do this directly.

Which font and size does apple use for the navigation bar title?

I made an totally custom navigation bar and would like to use the exact same font and size like apple does for the title of their navigation bar. It looks like some kind of fat printed arial, but not sure if that's right. Does anyone know?
iOS12 - iOS15 Large Title - System Bold 34 (San Francisco)
[UIFont boldSystemFontOfSize:34]
iOS9 - iOS15 Regular centered title - System Semibold 17 (San Francisco)
[UIFont systemFontOfSize:17 weight:UIFontWeightSemibold]
iOS8 - System Semibold 17 (Helvetica Neue)
[UIFont systemFontOfSize:17 weight:UIFontWeightSemibold]
iOS7 - System Bold 17 (Helvetica Neue)
[UIFont boldSystemFontOfSize:17];
Nice link about typo in iOS
https://learnui.design/blog/ios-font-size-guidelines.html
Definitely not Arial. It's Helvetica. You can probably get the same font using
UIFont *navFont = [UIFont boldSystemFontOfSize:18];
Change the size to find out what Apple is using (and write it below in a comment if you find the best one).
All the navigation bar text has a white shadow underneath it to give it the embossed effect. It's a white shadow 1 pixel underneath the text. Use shadowColor and shadowOffset in a UILabel to get the same effect.
For iOS7 the correct font size is 17pt:
UIFont *navFont = [UIFont boldSystemFontOfSize:17];
UIFont *navFont = [UIFont boldSystemFontOfSize:22];