Xcode Can';不要让Numberoflines和textAlignment都工作

Xcode Can';不要让Numberoflines和textAlignment都工作,xcode,uilabel,Xcode,Uilabel,当我第一次创建UIButton时,NSTextAlignment总是正确的 label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,landscapes?450:380, 120)]; label.frame = CGRectMake(0, 0,landscapes?450:380, 120); label.font = [UIFont fontWithName:@"Futura" size:60]; label.textColor = [U

当我第一次创建UIButton时,NSTextAlignment总是正确的

label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,landscapes?450:380, 120)];
label.frame = CGRectMake(0, 0,landscapes?450:380, 120);
label.font = [UIFont fontWithName:@"Futura" size:60];
label.textColor = [UIColor blackColor];
label.backgroundColor = [UIColor clearColor];
label.minimumScaleFactor = 0.2;
label.adjustsFontSizeToFitWidth = true;
label.adjustsLetterSpacingToFitWidth = true;
label.textAlignment = NSTextAlignmentCenter;
NSLog(@"%i",label.textAlignment);
label.text = n;
[self addSubview:label];
但是,每次我都为行数输入一个参数

label.numberOfLines = 2;

标签没有文本对齐。

请看另一篇关于垂直对齐的stackoverflow文章。我认为使用sizeToFit和numberOfLines=0,然后指定宽度将有助于使其水平居中