//普通text
// 1. label展示多行, 这种情形需要手动设置frame的高宽;
UILabel * label = [[UILabel alloc] init];
label.bounds = CGRectMake(0, 0, 200, 200);
label.center = self.view.center;
label.textAlignment = NSTextAlignmentCenter;
label.text = @"xxxxxxxx111ddddddddddddddddflsllkjfjlsljgljdljsljfjlsljfljj";
//需要设置截断方式
label.lineBreakMode = 0; ///wordWrap
//需要设置numberOfline 行数
label.numberOfLines = 0;
label.backgroundColor = [UIColor redColor];
[self.view addSubview:label];
self.view.frame = [UIScreen mainScreen].bounds;
//2. 下面的情形多用于labelText只有一行的情形: 如果多行,请用AttributeString;
UILabel * label_1 = [[UILabel alloc] init];
label_1.backgroundColor = [UIColor yellowColor];
label_1.frame = CGRectZero;
label_1.center = self.view.center;
NSLog(@"%@", NSStringFromCGPoint(self.view.center));
label_1.textAlignment = 0;
label_1.text = @"xj都快乐分开了带来快乐";
[label_1 sizeToFit];
[self.view addSubview:label_1];
//3. 单行文字过长,中间出现省略号;
label_1.text = @"shffklsklkls速度快哭了说多了都顶顶";
// label_1.lineBreakMode = NSLineBreakByTruncatingMiddle;
//4 单行label固定长度, 文字处于范围浮动
label_1.adjustsFontSizeToFitWidth = YES;
label_1.adjustsLetterSpacingToFitWidth = YES;
label_1.minimumScaleFactor = 0.5;