How to get the default font name and size for UIPickerview picker values in iOS 7 and iOS 6.
Asked
Active
Viewed 3,561 times
6
-
Please refer to [this](http://stackoverflow.com/questions/7185440/how-to-change-the-font-size-in-uipickerview) question, to know how to access the labels in `UIPickerView`. From there, you can get it's font easily. – n00bProgrammer Apr 17 '14 at 05:44
-
Can you explain your goal? – Rashad Apr 17 '14 at 05:44
-
@n00bprogrammer , ur link is not helpful. In ur link, we need define not to get what font used. – sehaswaran Apr 17 '14 at 05:50
-
@Rashad, i am customizing the pickerview , but i want to set the same font name and size for iOS 7 and iOS 6. – sehaswaran Apr 17 '14 at 05:51
-
@sehaswaranmayilerum, If your goal is just creating pickerview with current font name and size means, what is the need of getting that details. Just add pickerview, this pickerview will take default fontname and size. – Ramdhas Apr 17 '14 at 05:56
-
@Ramdy i am not just creating pickerview. i am customizing. – sehaswaran Apr 17 '14 at 05:58
-
ok even your customizing with default font name and size, you don't need to get that details. – Ramdhas Apr 17 '14 at 06:00
-
@Ramdy ok. fine. We don't need get . But, Do u know how to get those details? – sehaswaran Apr 17 '14 at 06:02
-
ya tried to get, but failded . @sehaswaranmayilerum – Ramdhas Apr 17 '14 at 06:04
-
Default is set to system font as I know. – Rashad Apr 17 '14 at 06:06
-
@Rashad Thanks. Do you have any idea on font size? – sehaswaran Apr 17 '14 at 06:10
-
@Sehaswaranmayilerum > Most probably 17, not sure about this. – Rashad Apr 17 '14 at 06:20
-
@Rashad Ok. thanks. Is 17 works for both iOS 7 and iOS 6. – sehaswaran Apr 17 '14 at 06:36
-
I don't think that there should be any problem in you set 17 for both iOS 6 & 7. – Rashad Apr 17 '14 at 06:38
3 Answers
4
On iOS 10.3, iPhone and iPad, the default UIPickerView font is:
font-family: ".SFUIDisplay"; font-weight: normal; font-style: normal; font-size: 21.00pt

kelin
- 11,323
- 6
- 67
- 104
-
-
2@BallpointBen, I found this in Xcode while was exploring UIPickerView subviews with Debug View Hierarchy tool. Try it. – kelin Jan 28 '18 at 21:03
-
1You may get this by running: let font = UIFont.preferredFont(forTextStyle: .largeTitle) print(font) – JoeGalind Jul 11 '18 at 17:05
-
@JoeGalind I like this approach, but .largeTitle is much too large for UIPickerView. .title2 looks closer. – arlomedia Jul 09 '21 at 18:56
2
On iOS 12 the font used for the centered component as displayed seems to be San Francisco Display (SystemFont)
with weight Regular
and size 23.5
.

Ben Packard
- 26,102
- 25
- 102
- 183
0
Below show default font detail and size. I simple made a demo to check for your answer and code is below :-
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
UILabel *label = [[UILabel alloc] init];
label.text =@"testRr";
NSLog(@"%@",[label font]);
return label.text;
}
Log print is as below -
So when you customize your picker it's upto you to pick which font or size you want to use. you could also add your own font-family.

nikhil84
- 3,235
- 4
- 22
- 43
-
Hello All, when you vote down for an answer then please provide a comment for doing so. This way all of us could improve ourself regardless of my answer being right or wrong. – nikhil84 Aug 06 '15 at 04:38
-
2I think people are down voting because your answer shows the font size for a custom label in the UIPickerView not the default used if you the method of just providing strings. `- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component` – Wombat Oct 01 '15 at 14:21
-
@Wombat : ok thanks ! Then do u have any solution for that as per me when we use the picker we do pass the label (with/without customisation) so we could check that labels font/size. Pls update me if you know a way. Once again thanks :) – nikhil84 Oct 05 '15 at 05:08