Thursday, 11 July 2013

Strike out the text in UILabel. Cut the text with line iOS.


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];

No comments:

Post a Comment