UILabel 文本
//样式定制
label.text = @"hello world!";
label.textColor = [UIColor redColor];
label.textAlignment = NSTextAlignmentCenter;
label.backgroundColor = [UIColor blueColor];
label.font = [UIFont boldSystemFontOfSize:20];
label.shadowOffset = CGSizeMake(10, 10);
label.shadowColor = [UIColor yellowColor];
label.highlighted = YES;
label.highlightedTextColor = [UIColor greenColor];
label.numberOfLines = 0;
label.baselineAdjustment = UIBaselineAdjustmentNone;
label.lineBreakMode = NSLineBreakByCharWrapping;
//创建一个Label
UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(60, 200, 200, 200)];
//给Label提供显示内容
label.text = @"Yestory is history,and tomorrow is mystery,but taday is a gift,that's why it's call present";
//把Label显示到屏幕上。
//Labelf
//
label.backgroundColor = [UIColor greenColor];
//修改Label的对齐模式
label.textAlignment = NSTextAlignmentCenter;
//靠左 NSTextAlignmentLeft
//居中 NSTextAlignmentCenter
//靠右 NSTextAlignmentRight
label.font = [UIFont systemFontOfSize:35];
// label.font = [UIFont italicSystemFontOfSize:30];
// label.font = [UIFont boldSystemFontOfSize:30];
// label.font = [UIFont fontWithName:@"Party LET" size:40];
NSArray * array = [UIFont familyNames];
NSLog(@"%@",array);
//限制最多显示的行数 , 默认值是 1
label.numberOfLines = 10;
//换行模式
// label.lineBreakMode = NSLineBreakByCharWrapping;
// label.lineBreakMode = NSLineBreakByClipping;
// label.lineBreakMode = NSLineBreakByTruncatingHead;
// label.lineBreakMode = NSLineBreakByTruncatingMiddle;
label.lineBreakMode = NSLineBreakByTruncatingTail;
// NSLineBreakByCharWrapping 按字符截断
// NSLineBreakByClipping 按单词换行 从末尾裁剪最后一行
// NSLineBreakByTruncatingHead 按单词换行,末尾一行从头开始删节
label.textColor = [UIColor redColor];
//给文字添加阴影效果
label.shadowOffset = CGSizeMake(5, 5);
label.shadowColor = [UIColor blackColor];
//标记 不能赋值为0
label.tag = 10;
//字体大小 自适应内容
label.adjustsFontSizeToFitWidth = YES;
label.minimumScaleFactor = 0.5;
[self.view addSubview:label];