How to use kCTSuperscriptAttributeName?

Looking through some other SO questions, it seems like other people are having trouble getting kCTSuperscriptAttributeName to display add-ins and indexes correctly. I could not find a successful implementation of kCTSuperscriptAttributeName, although Apple docs claim it works.

I tried this, but xCode shows an error listing it as an "undeclared identifier"

 NSDictionary * superscriptAttrs = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:kCTSuperscriptAttributeName];

Some people also claim that you can create superscripts and indexes via WebViews, but my indexes / superscripts should be dynamic, so I'm afraid this method will complicate things.

Perhaps the correct way to implement kSupersciptAttributeName or an alternative route that I could use to create scripts would be appreciated. Thanks

+5
source share
1 answer

You need #import <CoreText/CTStringAttributes.h>

+12
source

All Articles