简体   繁体   中英

What is the default font name and size for UIPickerview picker values in iOS 7 and iOS 6

如何在iOS 7和iOS 6中获取UIPickerview选择器值的默认字体名称和大小。

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

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.

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 .

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM