OHAttributedLabel icon indicating copy to clipboard operation
OHAttributedLabel copied to clipboard

Support strikethrough (NSStrikethroughStyleAttributeName)

Open gardnermj opened this issue 13 years ago • 3 comments

Strikethrough works in UILabel (using NSStrikethroughStyleAttributeName = NSUnderlineStyleSingle), but doesn't seem to work in OHAttributedLabel.

gardnermj avatar Jan 22 '13 15:01 gardnermj

Are you sure that the CoreText framework support this attribute?

As OHAttributedLabel is based on CoreText (because it is the only framework, available since iOS 3.2/4.0+, that can draw attributed strings before iOS6 added support for them in UIKit) and not on the newly introduced UIKit methods, if attributes not supported by CoreText itself are used, you won't see their effect.

I'll make some tests anyway with this attribute, but can you tell the code you did try on your own? Thx

AliSoftware avatar Jan 23 '13 21:01 AliSoftware

After some digging, I confirm that NSStrikethroughStyleAttributeName is only supported on UIKit (and on OSX) but not by CoreText on iOS.

Unfortunately I won't have time soon to write anything to work around this CoreText limitation and add support for this attribute, but feel free to try yourself and propose a pull request. I saw some interesting code from Cocoanetics (see end of the page) that you can use for inspiration to implement this strikethru yourself, as Apple didn't feel in the mood to support it itself in CoreText…

AliSoftware avatar Jan 23 '13 22:01 AliSoftware

Ah, that's unfortunate. Thanks for the pointer; I don't know if I'll have time to implement it either, but I'll let you know if I do.

gardnermj avatar Jan 24 '13 17:01 gardnermj