UILabel怎么做到顶端对齐


一个UILabel,如果内容很短的话就会垂直居中,但是我希望他顶端对齐,改怎么做?

UILabel *label = [[UILabel alloc] initWithFrame:self.view.bounds];
label.text = @"各种居中";
label.textAlignment = UITextAlignmentCenter;
[self.view addSubview:label];

各种居中

uilabel ios

s155336 10 years, 9 months ago
label.numberOfLines = 0;
[label sizeToFit];
不可名状D月 answered 10 years, 9 months ago

Your Answer