UITextView with Syntax Highlighting

Viewed 30169

How to do Syntax Highlighting in a UITextView, specifically syntax highlighting (and detection) for Objective-C on the iPhone?

Some of my ideas of how to do this:

  • NSAttributedString. Now available in iOS 3.2 and greater. But how would I put a NSAttributedString into a UITextView?
  • UIWebView. Overlay it when the user finished editing and color the text with CSS stylesheets. But how would I do this in a UIWebView, giving it the text and then coloring it?
5 Answers
Related