NSSuperscriptAttributeName show error?

狂风中的少年 提交于 2019-12-13 04:05:58

问题


I am trying to create a subscripted text in iphone using NSMutableAttributedString. But the "NSSuperscriptAttributeName" show some error " undeclared identifier ". How can i solve it?

NSDictionary * superscriptAttrs = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] 
                                                                  forKey:NSSuperscriptAttributeName];
    NSAttributedString * st = [[NSAttributedString alloc] initWithString:@"st"
                                                              attributes:superscriptAttrs];

回答1:


Assuming that you're on iOS, you need to use a different set of constants which you can find here.

In your case NSSuperscrptAttributeName should be kCTSuperscriptAttributeName.



来源:https://stackoverflow.com/questions/7121449/nssuperscriptattributename-show-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!