在iOS 14 VZ 15

发布于 2025-02-12 01:43:55 字数 1337 浏览 0 评论 0原文

上下文:

在使用时,我会在ios15 vz ios14 xcode 13上观察我的文本的更大尺寸。

我的观察结果是:标签的同一框架在不同的文本大小上以一定比例的heiht:1,宽度:4

更陌生的人,如果我增加了框架的高度,行为返回到就像旧的那样,这不会影响ios14的行为,

// First label is render smaller on iOS 15 vz 14
UILabel *yourLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 160, 40)];
[yourLabel1 setTextColor:[UIColor brownColor]];
[yourLabel1 setBackgroundColor:[UIColor systemRedColor]];
[yourLabel1 setFont:[UIFont  boldSystemFontOfSize:52]];
[yourLabel1 setText:@"HELLO"];

yourLabel1.minimumScaleFactor = 0.2;
yourLabel1.adjustsFontSizeToFitWidth = YES;
[self.view addSubview:yourLabel1];

// Second label is render equal on iOS 15 and 14 only difference is a change on the height 
UILabel *yourLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 300, 160, 60)];
[yourLabel2 setTextColor:[UIColor brownColor]];
[yourLabel2 setBackgroundColor:[UIColor systemRedColor]];
[yourLabel2 setFont:[UIFont  boldSystemFontOfSize:52]];
[yourLabel2 setText:@"HELLO"];
yourLabel2.minimumScaleFactor = 0.2;
yourLabel2.adjustsFontSizeToFitWidth = YES;

 
[self.view addSubview:yourLabel2];

为什么我现在真的想现在会发生这种情况,而在ios15上发生了变化?

Context:

Im observing a bigger down size of my text when using .adjustsFontSizeToFitWidth on iOS15 vz iOS14 Xcode 13 but i haven't find any release notes explaining why.

enter image description here

My observations are this: Same frame for the label result on a different text size in a proportion of heiht: 1, width:4

even more stranger if I increase the height of the frame the behavior returns to be like the old one and this don't affect behavior on iOS14

// First label is render smaller on iOS 15 vz 14
UILabel *yourLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 160, 40)];
[yourLabel1 setTextColor:[UIColor brownColor]];
[yourLabel1 setBackgroundColor:[UIColor systemRedColor]];
[yourLabel1 setFont:[UIFont  boldSystemFontOfSize:52]];
[yourLabel1 setText:@"HELLO"];

yourLabel1.minimumScaleFactor = 0.2;
yourLabel1.adjustsFontSizeToFitWidth = YES;
[self.view addSubview:yourLabel1];

// Second label is render equal on iOS 15 and 14 only difference is a change on the height 
UILabel *yourLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 300, 160, 60)];
[yourLabel2 setTextColor:[UIColor brownColor]];
[yourLabel2 setBackgroundColor:[UIColor systemRedColor]];
[yourLabel2 setFont:[UIFont  boldSystemFontOfSize:52]];
[yourLabel2 setText:@"HELLO"];
yourLabel2.minimumScaleFactor = 0.2;
yourLabel2.adjustsFontSizeToFitWidth = YES;

 
[self.view addSubview:yourLabel2];

why I really wanna now is why is this happening, did something change on iOS15?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文