-1

I'm trying to add a strikethrough to some of my labels. My project supports 32 and 64 bit. Everything works great on iOS 8, but on iOS 7 on iPhone 5c the label just disappear. Here's my code:

NSMutableAttributedString *throughLineAttributeString = [[NSMutableAttributedString alloc] initWithString:label.text];
    [throughLineAttributeString addAttribute:NSStrikethroughStyleAttributeName
                                       value:@1
                                       range:NSMakeRange(0, [throughLineAttributeString length])];
label.attributedText = throughLineAttributeString;

What am I doing wrong?

YogevSitton
  • 10,068
  • 11
  • 62
  • 95

1 Answers1

-1

Try to change:

NSMutableAttributedString *throughLineAttributeString = [[NSMutableAttributedString alloc] initWithString:label.text];

to:

NSMutableAttributedString *throughLineAttributeString = [[NSMutableAttributedString alloc] initWithAttributedString:label.attributedText];
mityaika07
  • 652
  • 5
  • 14