6

How to get the default font name and size for UIPickerview picker values in iOS 7 and iOS 6.

sehaswaran
  • 141
  • 1
  • 8

3 Answers3

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

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.

enter image description here

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 -

enter image description here

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
  • 2
    I 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