title: Can I use NSAttributedString in Core Text in iOS?
body: <p>I'm trying to work out how to take an NSAttributedString and use it in Core Text on the iPad. I watched one of the WWDC videos (110) which has slides (but no source code) and it describes how to create an NSAttributedString, then just put it into a CTFramesetterRef:</p>
  
  <pre><code>CTFontRef helveticaBold = CTFontCreateWithName( CFSTR("Helvetica-Bold"), 24.0, NULL);
  
  NSString* unicodeString = NSLocalizedString(@"TitleString", @"Window Title");
  CGColorRef color = [UIColor blueColor].CGColor; NSNumber* underline = [NSNumber numberWithInt:kCTUnderlineStyleSingle|kCTUnderlinePatternDot];
  NSDictionary* attributesDict = [NSDictionary dictionaryWithObjectsAndKeys:helveticaBold, (NSString*)kCTFontAttributeName, color, (NSString*)kCTForegroundColorAttributeName, underline, (NSString*)kCTUnderlineStyleAttributeName, nil];
  NSAttributedString* stringToDraw = [[NSAttributedString alloc] initWithString:unicodeString attributes:attributesDict];
  
  CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(stringToDraw);
  
  CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
  CFRelease(framesetter);
  CTFrameDraw(frame, context);
  CFRelease(frame);
  </code></pre>
  
  <p>But when I try this, it throws the error:</p>
  
  <blockquote>
    <p>Passing argument 1 of 'CTFramesetterCreateWithAttributedString' from incompatible pointer type</p>
  </blockquote>
  
  <p>Are CFAttributedString and NSAttributedString 'toll-free bridged'? I've read somewhere that this is only true on OSX, but this is how Apple do it in their demo...</p>
  
  <p>Thanks!</p>
  
  <p>:-Joe</p>