1、
//
// ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor whiteColor];
CGFloat width = [[UIScreen mainScreen] bounds].size.width;
CGFloat height = [[UIScreen mainScreen] bounds].size.height;
UILabel * label1 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, width - 40, 30)];
label1.text = @"系统默认字体尺寸";
//系统默认字体尺寸
label1.font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
[self.view addSubview:label1];
UILabel * label11 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 + 40, width - 40, 30)];
label11.text = @"无修饰---系统默认字体尺寸";
//系统默认字体尺寸
label11.font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
[self.view addSubview:label11];
UILabel * label12 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 + 80, width - 40, 30)];
label12.text = @"粗体---系统默认字体尺寸";
//系统默认字体尺寸
label12.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
[self.view addSubview:label12];
UILabel * label13 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 + 120, width - 40, 30)];
// label13.text = @"斜体---系统默认字体尺寸";
label13.text = @"this is Italic";
//系统默认字体尺寸
label13.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]];
[self.view addSubview:label13];
UILabel * label2 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 + 160, width - 40, 30)];
label2.text = @"小字体尺寸";
//小字体尺寸
label2.font = [UIFont systemFontOfSize:[UIFont smallSystemFontSize]];
[self.view addSubview:label2];
UILabel * label3 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 + 200, width - 40, 30)];
label3.text = @"标签字体尺寸";
//标签字体尺寸
label3.font = [UIFont systemFontOfSize:[UIFont labelFontSize]];
[self.view addSubview:label3];
UILabel * label4 = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 + 240, width - 40, 30)];
label4.text = @"按钮字体尺寸";
//按钮字体尺寸
label4.font = [UIFont systemFontOfSize:[UIFont buttonFontSize]];
[self.view addSubview:label4];
NSArray * arrayOfFont = [UIFont familyNames];
NSLog(@"%@", arrayOfFont);
//根据字体名创建字体
// UIFont * font = [UIFont fontWithName:<#(nonnull NSString *)#> size:<#(CGFloat)#>]
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
所有系统字体:
2015-12-02 09:30:10.468 07-uifont[852:14091] (
Copperplate,
"Heiti SC",
"Iowan Old Style",
"Kohinoor Telugu",
Thonburi,
"Heiti TC",
"Courier New",
"Gill Sans",
"Apple SD Gothic Neo",
"Marker Felt",
"Avenir Next Condensed",
"Tamil Sangam MN",
"Helvetica Neue",
"Gurmukhi MN",
"Times New Roman",
Georgia,
"Apple Color Emoji",
"Arial Rounded MT Bold",
Kailasa,
"Kohinoor Devanagari",
"Kohinoor Bangla",
"Chalkboard SE",
"Sinhala Sangam MN",
"PingFang TC",
"Gujarati Sangam MN",
Damascus,
Noteworthy,
"Geeza Pro",
Avenir,
"Academy Engraved LET",
Mishafi,
Futura,
Farah,
"Kannada Sangam MN",
"Arial Hebrew",
Arial,
"Party LET",
Chalkduster,
"Hoefler Text",
Optima,
Palatino,
"Lao Sangam MN",
"Malayalam Sangam MN",
"Al Nile",
"Bradley Hand",
"PingFang HK",
"Trebuchet MS",
Helvetica,
Courier,
Cochin,
"Hiragino Mincho ProN",
"Devanagari Sangam MN",
"Oriya Sangam MN",
"Snell Roundhand",
"Zapf Dingbats",
"Bodoni 72",
Verdana,
"American Typewriter",
"Avenir Next",
Baskerville,
"Khmer Sangam MN",
Didot,
"Savoye LET",
"Bodoni Ornaments",
Symbol,
Menlo,
"Bodoni 72 Smallcaps",
Papyrus,
"Hiragino Sans",
"PingFang SC",
"Euphemia UCAS",
"Telugu Sangam MN",
"Bangla Sangam MN",
Zapfino,
"Bodoni 72 Oldstyle"
)