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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
you can change any specific word font, style and size also,
Make UITextView text to "Attributed", by default it was "Plain" and then you can perform edition on selected text.