Best way to strike out a text

iphone, nsstring, uilabel

Solution

In iOS 6 we can use "NSMutableAttributedString" for 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];

Problem

What is the best solution so far for a strike out text on the iPhone? I heard of multiple solutions: - Something with three20 - Image as a subview - `UIWebView` And something with a `NSAttributedString`, but I don't find a working example for that.

Original source

Related problems