文字屬性Attributes

2021-07-14 02:09:04 字數 1990 閱讀 3531

nsstrokewidthattributename這個屬性所對應的值是乙個 nsnumber 物件(小數)。該值改變描邊寬度(相對於字型size 的百分比)。預設為 0,即不改變。正數只改變描邊寬度。負數同時改變文字的描邊和填充寬度。例如,對於常見的空心字,這個值通常為3.0。

同時設定了空心的兩個屬性,並且nsstrokewidthattributename屬性設定為整數,文字前景色就無效果了

效果:

效果:

效果:

效果:

和這三個任乙個都好使,

nsverticalglyphformattributename

,nsobliquenessattributename,n***pansionattributename

該屬性所對應的值是乙個 nsnumber 物件(整數)。0 表示橫排文字。1 表示豎排文字。在 ios 中,總是使用橫排文字,0 以外的值都未定義。

效果:

效果:效果:

nsmutableattributedstring*attributedstring = [[nsmutableattributedstring alloc]initwithstring:labeltext];

nsmutableparagraphstyle*paragraphstyle = [[nsmutableparagraphstyle alloc] init];

[paragraphstylesetlinespacing:linespace];//

調整行間距

[attributedstringaddattribute:nsparagraphstyleattributename value:paragraphstylerange:nsmakerange(0, [labeltext length])];

label.attributedtext = attributedstring;

nsmutableattributedstring*string =[[nsmutableattributedstring alloc]initwithstring:self.text];

longnum

ber= self.characterspacing;

cfnum

berrefnum

=cfnumbercreate(kcfallocatordefault,kcfnumbersint8type,&number);

[string addattribute:(id)kctkernattributenamevalue:(id)num rang:nsmakerange(0,[string length])];

cfrelease(num);

iOS 詳解文字屬性Attributes

寬度。例如,對於常見的空心字,這個值通常為3.0。同時設定了空心的兩個屬性,並且nsstrokewidthattributename屬性設定為整數,文字前景色就無效果了 效果 效果 效果 效果 和這三個任乙個都好使,nsverticalglyphformattributename,nsoblique...

文字屬性Attributes的用法

設定segment的顯示樣式。typedef ns enum nsinteger,uisegmentedcontrolstyle default tintcolor is nil.only used if style is uisegmentedcontrolstylebar 預設空,只有使用uis...

字型屬性 文字屬性

font family 微軟雅黑 字型 font size 16px 瀏覽器預設大小 16px 字型大小大小 font weight 400代表正常 700代表加粗 字型粗細 font style normal 預設正常 italic 斜體 文字樣式 字型復合屬性 順序 swsf font font...