更改UITextView中所选字或行的字体格式 [英] Changing font formattings of selected word/line in a UITextView

查看:76
本文介绍了更改UITextView中所选字或行的字体格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人试图更改UITextView中所选单词或句子的字体格式(粗体/斜体/颜色),如文本编辑器应用程序?我一直试图这样做,但似乎格式化仅适用于整个文本,而不是单个单词或句子。

Has anyone tried to change the font formatting(bold/italic/color) of a selected word or sentence in a UITextView, like a text editor application? I have been trying to do this but it seems formatting is applied only to the whole text, not on individual words or sentences.

推荐答案

UITextView 无法设置文本片段的样式。样式,颜色和字体应用于整个文本。您可能希望使用 UIWebView 或Core Text来渲染文本。

UITextView cannot style text fragments. Styles, colors and fonts are applied to the entire text. You may wish to use a UIWebView or Core Text to render your text instead.

这篇关于更改UITextView中所选字或行的字体格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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