线上效果图
对于大段文字在Label中显示,需要折行,并且两端对齐这种。

其实最好的解决办法就是
不用UILabel,用UItextView = ̄ω ̄=
Show me the Code
- (void)viewDidLoad {
[super viewDidLoad];
UITextView *label = [[UITextView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
label.text = @"春风十里不如你\n春风十里,五十里,一百里,体测八百米,海底两万里,德芙巧克力,可可布朗尼。香草味八喜,榴莲菠萝蜜。鸡汁土豆泥,芝士玉米粒,黄焖辣子鸡,碧玉金镶玉,红烧狮子头,黑椒牛里脊,香橙排骨糖醋鱼。不如你,全都不如你。";
label.layer.borderWidth = 1;
label.layer.borderColor = [UIColor blackColor].CGColor;
label.userInteractionEnabled = NO;
label.textAlignment = NSTextAlignmentJustified;
[self.view addSubview:label];
}
网友评论