字體顏色—隨機(jī)
其中的字體家族名和字體名可以通過以下方法獲取:
NSLog(@"familyNames:%@",[UIFont familyNames]);
/*
UIFontDescriptorFamilyAttribute:設(shè)置字體家族名
UIFontDescriptorNameAttribute ?:設(shè)置字體的字體名
UIFontDescriptorSizeAttribute ?:設(shè)置字體尺寸
UIFontDescriptorMatrixAttribute:設(shè)置字體形變
*/
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];
隨機(jī)顏色:
[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"
)