gpt4 book ai didi

ios - 允许 UILabel 截断文本,但在单词边界处

转载 作者:可可西里 更新时间:2023-11-01 04:58:23 25 4
gpt4 key购买 nike

<分区>

我使用 UILabel 来显示文本,例如:

UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 100, 50)];
label.text = @"I love Apple very much";
[self.view addSubview:label];

但是当我的标签太短时,文本会默认被截断:

I love Apple ve...

我希望文本被截断,但保留整个单词,并保持框架大小:

I love Apple...

或者:

I love Apple very...

我该怎么做?

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