菜鸟教程小白 发表于 2022-12-11 19:41:09

ios - UIButton 属性标题上的系统字体消失


                                            <p><p>我有一个 UIButton,我将其标题更改为 <code>attributed</code>。</p>

<p>既然标题已归属,我需要保留字体 - “系统字体”。</p>

<p>很遗憾,我找不到系统字体,因为当我将 UIButton 标题设置为属性时,我无法再获得此菜单:</p>

<p> <a href="/image/8HrfA.png" rel="noreferrer noopener nofollow"><img src="/image/8HrfA.png" alt="the good menu"/></a> </p>

<p>相反,我只得到这个菜单:</p>

<p> <a href="/image/9fgjE.png" rel="noreferrer noopener nofollow"><img src="/image/9fgjE.png" alt="bad menu"/></a> </p>

<p>在这里,在较大的菜单中,我找不到系统字体。</p>

<p>菜单中的系统字体在哪里,或者在使用 UIButton 属性标题时如何通过界面生成器添加系统字体?</p>

<p>请不要建议“在 UIButton 下添加带有 _______ 的标签”或“带有文本的 UIImageView”。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>当前iOS系统字体为“旧金山”</p>

<p>您可以通过以下方式使用它:</p>

<pre><code>UIFont.systemFont(ofSize: CGFloat, weight: UIFontWeight)
</code></pre>

<p>您也可以通过此页面上的链接下载字体:<a href="https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/" rel="noreferrer noopener nofollow">https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - UIButton 属性标题上的系统字体消失,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/48523250/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/48523250/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - UIButton 属性标题上的系统字体消失