The best way to cross out text

What is the best solution for striking out text on an iPhone?

I have heard of several solutions:

  • Something with three
  • View Image
  • UIWebView And something with NSAttributedString , but I do not find a working example for this.
+4
source share
2 answers

In iOS 6, we can use "NSMutableAttributedString" to use more different styles.

  NSString* cutText = @"This Line is strike out."; NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:cutText]; // making text property to strike text- NSStrikethroughStyleAttributeName [titleString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [titleString length])]; // using text on label [myTextLabel setAttributedText:titleString]; 
+11
source

You can try my solution for a subclass of UILabel that supports:

multi-line text with different label borders (the text may be in the middle of the label frame or the exact size)

  • underline
  • out
  • underline / out line offset
  • text alignment
  • various font sizes

https://github.com/GuntisTreulands/UnderLineLabel

0
source

All Articles