NSSuperscriptAttributeName show error?
I am trying to create a subscripted text in iphone using NSMutableAttributedString. But the "NSSup开发者_开发百科erscriptAttributeName" 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];
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
.
精彩评论