UILabels和Unicode [英] UILabels and Unicode
问题描述
我知道有类似这样的问题,但我没有找到满意的答案。
I know questions similar to this have been asked, but I haven't found a satisfactory answer.
我正在尝试创建一个UILabel来显示一个等式。我不喜欢为指数和下标设置多个标签,因为我将要进行计算,指数和下标的位置必须转移以保持格式化。相反,我想在我的UILabel中输入上标和下标'n'(分别为0x207F和0x2099)的Unicode形式,并在答案改变时让它们相应地移动。我一直在寻找一段时间,但我找不到答案。有没有办法做到这一点?
I'm trying to create a UILabel to display an equation. I don't like having multiple labels for exponents and subscripts, though, because I'm going to be making calculations, and the positions of the exponents and subscripts will have to shift to maintain formatting. Instead, I'd like to enter in the Unicode forms of superscript and subscript 'n' (0x207F and 0x2099 respectively) within my UILabel, and have them shift accordingly when the answers change. I've been searching for a while now, and I haven't been able to find an answer. Is there a way to do this?
推荐答案
你可以在uilabel中分配一个unicode,如下所示 -
you can assign a unicode in uilabel as follows -
[yourLabel settext:@"\u207F and \u2099"];
这篇关于UILabels和Unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!