菜鸟教程小白 发表于 2022-12-11 19:08:22

ios - 多行 UILabel 没有正确换行


                                            <p><div>
            <aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
      <div class="d-flex fd-column fw-nowrap">
            <div class="d-flex fw-nowrap">
                <div class="flex--item wmn0 fl1 lh-lg">
                  <div class="flex--item fl1 lh-lg">
                        <b>这个问题在这里已经有了答案</b>:
                        
                  <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p><strong> swift3</strong>
<br/>为动态文本信息设置行数为零,这将有助于改变文本。</p>

<pre><code>var label = UILabel()
let stringValue = &#34;Multiline UILabel not wrapping words correctly&#34;
label.text = stringValue
label.numberOfLines = 0
label.lineBreakMode = .byTruncatingTail // or .byWrappingWord
label.minimumScaleFactor = 0.8 . // It is not required but nice to have a minimum scale factor to fit text into label frame
</code></pre>

<p><strong>使用界面生成器:</strong></p>

<p> <img src="/image/ej8F9.png" alt="enter image description here"/> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 多行 UILabel 没有正确换行,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/42561809/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/42561809/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 多行 UILabel 没有正确换行