菜鸟教程小白 发表于 2022-12-12 22:57:22

Objective-C,UITextView中首字母的自定义样式


                                            <p><p>有什么方法可以自定义<code>UITextView</code>中的首字母,改变<strong>color</strong>、<strong>font size</strong>和<strong>font family</strong> ? <br/>
看下面的截图:<br/></p>

<p> <img src="/image/SoMoa.png" alt="enter image description here"/> </p>

<p><strong>编辑:</strong><br/>
有纯 Objective-C 实现吗?<br/>
当然,最好支持 <strong>iOS4 及更高版本</strong>。</p>

<p>谢谢</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>在 iOS 6 中,您可以使用简单的 <code>NSAttributedString</code>,分配 <code>attributedText</code>。</p>

<p><code>NSAttributedString</code> 允许您为一系列字符指定属性字典。</p>

<p><strong>更新</strong></p>

<blockquote>
<p>Sure, better if it would support iOS4 and later.</p>
</blockquote>

<p>回到那一步的快速简便的方法是使用 <code>UIWebView</code>,它能够呈现 PDF、HTML、RTF、RTFD 等。</p></p>
                                   
                                                <p style="font-size: 20px;">关于Objective-C,UITextView中首字母的自定义样式,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/12744230/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/12744230/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: Objective-C,UITextView中首字母的自定义样式