Hi,
Is it possible to use the CFAttributedString type to draw formatted text on the iPhone? I see it in the documentation, but I can't figure out how to actually draw it to a context.
Thanks,
Kyle
Hi,
Is it possible to use the CFAttributedString type to draw formatted text on the iPhone? I see it in the documentation, but I can't figure out how to actually draw it to a context.
Thanks,
Kyle
Actually, it turns out this is answered in the iPhone documentation, I just didn't read it carefully enough:
iPhone OS Note: While Core Foundation on iPhone OS contains CFAttributedString, there are no additions to the APIs in UIKit to add specific attributes such as font, style, or color, and there are no APIs to draw attributed strings.
There you go, no free formatted text. Bummer.
Kyle
The workaround is to use a WebKitView. Format your text as HTML and display in a mini web view at whatever size you need.
There's an undocumented method on TextView to pass in HTML formatted text (it's really a kind of web view underneath). A number of apps in the store make use of it, just make sure your app works without it there.
Three20 has a formatted text field. Basically Joe Hewitt implemented a light HTML interpreter to render the text, so it is much faster than a webview. fast enough to be used in a tableview.