gpt4 book ai didi

iphone - 以编程方式创建 UILabel

转载 作者:行者123 更新时间:2023-12-03 18:26:37 26 4
gpt4 key购买 nike

我通过代码执行了以下操作:

UILabel  * label = [[UILabel alloc] initWithFrame:CGRectMake(40, 70, 300, 50)];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter; // UITextAlignmentCenter, UITextAlignmentLeft
label.textColor=[UIColor whiteColor];
label.text = @"Telechargez et consultez les catalogues et les tarifs de la gamme Audi au format PDF";
[self.view addSubview:label];

看起来像this但我希望它看起来像 this 。如何更改标签的属性?

最佳答案

试试这个:

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 30, 300, 50)];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.numberOfLines = 0;
label.lineBreakMode = UILineBreakModeWordWrap;
label.text = @"Telechargez et consultez les catalogues et les tarifs de la gamme Audi au format PDF";
[self.view addSubview:label];

关于iphone - 以编程方式创建 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7428554/

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