Create a string with strikethrough text

suggest change

Objective-C

NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:@"Your String here"];
[attributeString addAttribute:NSStrikethroughStyleAttributeName
                    value:@(NSUnderlineStyleSingle)
                    range:NSMakeRange(0, [attributeString length])];

Swift

let attributeString: NSMutableAttributedString =  NSMutableAttributedString(string: "Your String here")
attributeString.addAttribute(NSStrikethroughStyleAttributeName, value: 1, range: NSMakeRange(0, attributeString.length)) // NSUnderlineStyleSingle

Then you can add this to your UILabel:

yourLabel.attributedText = attributeString;

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents