1

最初に 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;

ラベルのテキストが整列されていません。

4

1 に答える 1