AliSoftware / OHAttributedLabel

UILabel that supports NSAttributedString

Home Page:https://github.com/AliSoftware/OHAttributedLabel/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Superscript doesn't work

moughxyz opened this issue · comments

commented

I'm trying to add superscripts with your label, but it doesn't work:

OHAttributedLabel *label = [[OHAttributedLabel alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:@"Hello world my name is Ben Franklin"];
[attrStr setTextColor:[UIColor blackColor]];
[attrStr addAttribute:(NSString*)kCTSuperscriptAttributeName value:@(1) range:NSMakeRange(3, 5)];
[label setAttributedText:attrStr];
[self.view addSubview:label];

If I change OHAttributedLabel to UILabel (in iOS 6) with the same exact code as above, it works just fine.

Duplicate of #25 and #37 .

commented

Yes I noticed those. I think it might be helpful to have some sort of "limitations" section, where you discuss what is and isn't possible.

You're right, that's actually a good idea!
I'll try to add a dedicated page in the wiki and mention it in the README soon :)