iOS 11中UILabel错误的自动换行 [英] UILabel wrong word wrap in iOS 11

查看:957
本文介绍了iOS 11中UILabel错误的自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在没有自动布局的情况下使用XIB的应用程序有问题。我不知道这是否是重要信息。

I have problem with application using XIBs without autolayout. I don't know if this is important information.

我有UILabel有2行使用自动换行。在iOS 10中,自动换行正常工作,第一行包含一个单词+特殊字符,例如&符号。示例:

I have UILabel with 2 lines using word wrap. In iOS 10 word wrap was working correctly, and first line contained one word + special character, for example ampersand. Example:

然后在iOS 11上自动换行是以某种方式工作错误并将放大器放到第二行:

Then on iOS 11 word wrap is working somehow wrong and puts ampresand to the second line:

这是有问题的,因为通常在第二行上安装的较长的单词现在没有正确显示。知道改变了什么吗?我知道safeArea但它看起来不像是理由。任何想法如何将该&符号移到顶部哪里有足够的空间?

This is problematic as longer words, that normally fitted on second line now are not being shown correctly. Any idea what has changed? I know about safeArea but it doesn't look like reason. Any ideas how to move that ampersand to the top where is plenty of space for it?

其余设置:

推荐答案

这很可能是Apple故意改变以防止丧偶的线路。从设计的角度来看,最好避免在一行文本上使用单个单词。因此,似乎UILabel现在打破了这条线,第二行文字总是至少有2个单词。

This could very likely be an intentional change by Apple to prevent widowed lines. From a design perspective, it is preferred to avoid having a single word on a line of text. So it seems that UILabel now breaks the line in a way that a the second line of text always has at least 2 words on it.

令人惊讶的是,没有文档或方法来禁用此行为。

It is surprising that there is no documentation or way to disable this behavior though.

这里还有一篇好文章关于丧偶和孤儿文本。

Also here's a good article about "widowed"and "orphaned text.

这篇关于iOS 11中UILabel错误的自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆