2019独角兽企业重金招聘Python工程师标准>>>
Label.textAlignment = NSTextAlignmentRight;
// 使文本里的文字对齐的枚举值
NSTextAlignmentLeft = 0, // 左对齐
NSTextAlignmentCenter = 1, // 居中
NSTextAlignmentRight = 2, // 右对齐
NSTextAlignmentJustified = 3, // 一段话,最后一段自动对齐。
NSTextAlignmentNatural = 4, // 默认对齐方式
Label自动换行
Lable.lineBreakMode = NSLineBreakByWordWrapping
Lable.numberOfLines = 0;
label高度自适应
CGRect rect = [string boundingRectWithSize:CGSizeMake(self.view.frame.size.width - 40, 1000)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil];