UILabel的常用方法

文字大小自适应

myLabel.adjustsFontSizeToFitWidth = YES; //假设文字内容为@"曾在月光之下望烟花,曾共看夕阳渐降下",Label长度为200,则一行显示不下,若设置此属性为YES,则会降低字体大小,以显示全部内容。
NSParagraphStyle  段落样式

NSLineBreakByWordWrapping = 0,     //按包含单词为界限截断
NSLineBreakByCharWrapping,        //按字符为界限截断
NSLineBreakByClipping,    //简单的修剪
NSLineBreakByTruncatingHead,    /* Truncate at head of line: "...wxyz" */     //截断头部
NSLineBreakByTruncatingTail,    /* Truncate at tail of line: "abcd..." */        //截断尾巴
NSLineBreakByTruncatingMiddle    /* Truncate middle of line:  "ab...yz" */        //截断中间
 
NSTextAlignmentLeft //左对齐
NSTextAlignmentCenter //居中
NSTextAlignmentRight  //右对齐
NSTextAlignmentJustified//最后一行自然对齐
NSTextAlignmentNatural //默认对齐脚本

 


 

posted @ 2016-07-21 11:28  PengYunjing  阅读(121)  评论(0)    收藏  举报