问题
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