字体颜色—随机
其中的字体家族名和字体名可以通过以下方法获取:
NSLog(@"familyNames:%@",[UIFont familyNames]);
/*
UIFontDescriptorFamilyAttribute:设置字体家族名
UIFontDescriptorNameAttribute :设置字体的字体名
UIFontDescriptorSizeAttribute :设置字体尺寸
UIFontDescriptorMatrixAttribute:设置字体形变
*/
UIFontDescriptor *attributeFontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:
@{UIFontDescriptorFamilyAttribute: @"Marion",
UIFontDescriptorNameAttribute:@"Marion-Regular",
UIFontDescriptorSizeAttribute: @40.0,
UIFontDescriptorMatrixAttribute:[NSValue valueWithCGAffineTransform:CGAffineTransformMakeRotation(M_1_PI*1.5)
]}];
fnotLabel.font = [UIFont fontWithDescriptor:attributeFontDescriptor size:0.0];
随机颜色:
[UIColor colorWithRed:(random()%255)/255.0 green:(random()%255)/255.0 blue:(random()%255)/255.0 alpha:1.0];
好看的字体推荐:
fontWithName:@"Arial-BoldItalicMT"
fontWithName:@"HelveticaNeue-Bold"
fontWithName:@"Courier-BoldOblique"
familyNames:(
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"
)