1.呈現(xiàn)文字的屬性 text ?返回值類型是NSString
lable.text=@"shieng";
2.文字的對齊方式
lable.textAlignment=NSTextAlignmentLeft; ? ? 左對齊(默認(rèn))
lable.textAlignment=NSTextAlignmenCenter; ? 居中
lable.textAlignment=NSTextAlignmentRight;? ? 右對齊
3.當(dāng)文字太多時(shí),需要換行,所以要設(shè)置行數(shù)
lable.numberOfLines=3;
4.當(dāng)文字太多時(shí),需要換行,所以需要換行方式
lable.lineBreakMode=NSLineBreakByWordWrapping;? 按照完整單詞或漢字換行(默認(rèn))
lable.lineBreakMode=NSLineBreakByCharWrapping; ?按照字母換行;
lable.lineBreakMode=NSLineBreakByTruncatingHead;? 行數(shù)設(shè)置少了,省略號(hào)在最后一行的最前面;
lable.lineBreakMode=NSLineBreakByTruncatingTail;? 行數(shù)設(shè)置少了,省略號(hào)在最后一行的最后面;
lable.lineBreakMode=NSLineBreakByTruncatingMiddle;? 行數(shù)設(shè)置少了,省略號(hào)在最后一行的中間;
5.文字大小的設(shè)置 ?和字體粗細(xì)的設(shè)置
lable.font=[UIFont systemFontOfSize:20 weight:20]; ? 有字體大小和粗細(xì)的設(shè)置
lable.font=[UIFont systemFontOfSize:20 ]; ? ? ? ? 只有字體大小的設(shè)置
6.文字字體樣式(宋體等)
? ? lable.font=[UIFont? ? fontWithName: @"Zapfino" ? ?size: 10];
? ? ?打印字體樣式
? ? ? NSLog(@"%@",[UIFont familyNames]);
7.文字顏色的設(shè)置
lable.textColor=[UIColor ? RedColor];
8.文字陰影顏色的設(shè)置
lable.shadowColor=[UIColor ? greenColor];
9.文字陰影的大小設(shè)置
lable.shadowOffset=CGSizeMake(3,3);
10.背景顏色
[lable setBackgroundColor:[UIColor? yellowColor]];
11.在lable上添加按鈕時(shí),按鈕不能觸發(fā)事件,因?yàn)閁ILable用戶交互默認(rèn)值是NO
[lable? setUserInteractionEnabled:YES]; ? ? ? ? ? ? ? ? ?設(shè)置啟用用戶交互
12.//邊框顏色? //邊框?qū)挾?//設(shè)置邊框?yàn)閳A角
label.layer.borderColor =[UIColor blackColor].CGColor;
label.layer.borderWidth = 1;
abel.layer.cornerRadius = 10;
????????????