****** OPTION 1 ******
.
If you want to hit the text in multi-line mode: use TTTAttributedLabel
create new files TTTAttributedLabel.h and TTTAttributedLabel.m (not from GITHUB because I configured one / two strikethrough functions)
http://www.2shared.com/file/Z_qZpWVd/TTTAttributedLabel.html
http://www.2shared.com/file/xXjmC-1M/TTTAttributedLabel.html
and where you need the strikethrough label - use TTTAttributedLabel instead of UILabel .
To set strikethrough =
TTTAttributedLabel *labelName = [[TTTAttributedLabel alloc] init]; labelName.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"TTTCustomStrikeOut"];
To set doublethrough =
TTTAttributedLabel *labelName = [[TTTAttributedLabel alloc] init]; labelName.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"TTTCustomDoubleStrikeOut"];
Add a range in which the text of the label should be crossed out + provide a link with the ability to click (zero, without a link):
//set link to nil, to NOT-have a link on taping on this label. [labelName addLinkToURL:nil withRange:NSMakeRange(0, [labelName.text length])];
PS - to correctly rearrange double lines of outs - edit the TTTAtributedLabel.m file on lines 483, 484 and 489, 490 (I have currently changed the top line y-2 and bottom y + 2 from the center. Tweak to get better results.)
.
****** OPTION 2 ******
.
Convert all string characters to special scroll characters.
You can get them from this homepage: http://adamvarga.com/strike/
Then you can - for example, put the necessary character translations in the language file:
"A" = "A̶"; "B" = "B̶"; "C" = "C̶"; "D" = "D̶"; "E" = "E̶"; "F" = "F̶"; "G" = "G̶"; "H" = "H̶"; ....
and use this function to turn a plain text string into a string striked out:
- (NSString *)returnStrikedOutTextFromString:(NSString *)mString { NSString * mNewString = @""; for(int i = 0; i<[mString length]; i++) { mNewString = [NSString stringWithFormat:@"%@%@",mNewString, NSLocalizedString([[mString substringToIndex:i+1] substringFromIndex:i],nil)]; } return mNewString; }
eg:
textLabel.text = [self returnStrikedOutTextFromString:@"string text"];
**** OPTION 3 ****
I would also suggest trying this subclass of UILabel mentioned here: Underline text in UIlabel
Hope this helps!