iPhone - Strike out an NSString [duplicate]
-
01-10-2019 - |
Question
This question already has an answer here:
- Best way to strike out a text 2 answers
I would like to know if there is an easy way to strike/cross out some text on the iPhone?
Thanks
Solution
Yes and No,
NSString is a simple class, that only stores unformated text, but you can use an NSAttributedString to store such information, i.e.
NSAttributedString* italicText = [[NSAttributedString alloc] initWithString:myNsString attributes:myCrossOutAttributes];
OTHER TIPS
NSMutableAttributedString *strikeThroughString = [[NSMutableAttributedString alloc] initWithString:anyString];
[strikeThroughString addAttribute:NSStrikethroughStyleAttributeName value:(NSNumber *)kCFBooleanTrue range:NSMakeRange(0, [as length])];
[m_cObjTaskTitle setAttributedText:strikeThroughString =];
cObjTaskTitle = UILabel ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow