在iOS 14 VZ 15
上下文:
在使用时,我会在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.
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论