如何使用NSAttributedString创建下标 [英] How to create a subscript with NSAttributedString

查看:126
本文介绍了如何使用NSAttributedString创建下标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到NSAttributedString有一个特定的上标的属性,但我找不到一个下标。使用NSAttributedString创建下标字符的一般做法是什么?

I see for NSAttributedString has a specific attribute for superscript, but I can't find one for subscript. What is the general practice for using NSAttributedString to create a subscript character?

示例:H2O

推荐答案

尝试具有负值的NSSuperscriptAttributeName

以替换字符串中的[0123456789]字符。

Failing that, the hard way would be to replace [0123456789] characters with [₀₁₂₃₄₅₆₇₈₉] in the string.

这篇关于如何使用NSAttributedString创建下标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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