Wednesday, 23 October 2013

strike out effect in UILABEL

we can apply strike out effect to label.
If we are tagetting ios 6.0 and above then we can apply this code

  NSString* cutText = @"Hi!!!Testing going on.";
    
  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

 [lbl_title  setAttributedText:titleString];

No comments:

Post a Comment