gpt4 book ai didi

iphone - UILabel 中心内容

转载 作者:可可西里 更新时间:2023-11-01 03:22:34 26 4
gpt4 key购买 nike

这是我的代码:

UILabel *myLabel;
myLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 300, 480)];
myLabel.lineBreakMode = UILineBreakModeWordWrap;
myLabel.numberOfLines = 2; // 2 lines ; 0 - dynamical number of lines
myLabel.text = @"Please select at least one image category!";
myLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size: 24.0];
myLabel.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2);
myLabel.backgroundColor = [UIColor clearColor];
[self.view addSubview:myLabel];
[myLabel release];

我想知道是否可以将换行的文本居中,因为它排在左侧: alt text

最佳答案

myLabel.textAlignment=UITextAlignmentCenter;

关于iphone - UILabel 中心内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4457779/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com