title: CoreText and strikethrough on iPhone
body: <p>I'm currently struggling with the need to display strikethrough text in many <code>UITableViewCell</code>s. Something that written in HTML would looke like</p>
  
  <pre>&lt;strike>€99&lt;/strike> save 50% => now €49</pre>
  
  <p>I don't want to use a <code>UIWebView</code> just for a single line of text, especially that it's used in small <code>UITableViewCell</code>s. I know there are reusable cells and all, but I'd like to keep things the more memory-efficient way possible.</p>
  
  <p>So... I'm using <code>NSAttributedString</code>s, with the help of AliSoftware's <code>UILabel</code>-replacement <code>OHAttributedLabel</code>. The fact that it's only available starting with iOS 4.0 is no problem, as we use all kinds of stuff only 4.0-compatible.</p>
  
  <p>I can manage to create the attributed string, it displays text in the <code>OHAttributedLabel</code>, OK, that's cool. But what I can't achieve is setting the "strikeout", or "strikethrough" attribute.</p>
  
  <p>Basically I go like this:</p>
  
  <pre>NSString *price = [NSString stringWithFormat:@"%01.2f €", product.price];
  NSString *rate = [NSString stringWithFormat:@" -%01.0f%%", product.reductionRate];
  
  NSMutableAttributedString *s = [NSMutableAttributedString attributedStringWithString:price];
  
  [s addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlinePatternSolid | NSUnderlineStyleSingle] range:NSRangeFromString(price)];
  [attributedLabel setAttributedText:s];</pre>
  
  <p>But here, the three <code>NS*</code> constants are undefined. I've imported <code>CoreText.h</code>, <code>Foundation/NSAttributedString.h</code>, to no avail. I've seen somewhere on the web that
  <code>NSStrikethroughStyleAttributeName = @"NSStrikethroughStyleAttributeName"</code>, and that <code>NSUnderlinePatternSolid = 0</code> and <code>NSUnderlineStyleSingle = 1</code>, but hard-coding these values don't give anything.
  One thing I got with auto-completion are the equivalent <code>kCT...*</code> constants, but there are <code>kCTUnderlineStyleAttributeName</code>, <code>kCTStrokeWidthAttributeName</code>, ... but no mention of <code>kCTStrikethrough</code>_anything.</p>
  
  <p>What should I do to display that *$|#!@ piece of strike-through text ?</p>