开发者

Is there a syntax highlighting editor component for Mac OS X

I am looking for a syntax highlighting component that I can include in a Mac OS X XCode project to allow editing of Ruby, C++, Lua, etc.

I need a component that开发者_JS百科 is open source or has the source included.

My Google searches didn't turn up much in the way of Mac OS X frameworks or components at all, let alone the type I am looking for.

Thanks for any pointers!


UKSyntaxColoredTextDocument (Mac-specific) or Scintilla (cross-platform and in use in a variety of editors, including Komodo) might be what you're looking for.


Try to use scintilla. http://www.scintilla.org/


You could try using CodeMirror. I do this in my SQLite Professional app to highlight user editable queries. It's also fairly simple to setup:

  1. In your project, add the CodeMirror contents as a Folder rather than a group.
  2. Add the WebKit.Framework to your project.
  3. Add a WebView to your nib/xib.

Add the following code:

// Load our webview from our local CodeMirror path
NSURL * url = [NSURL fileURLWithPath: [NSString stringWithFormat:@"%@/CodeMirror/Demo/preview.html", [[NSBundle mainBundle] resourcePath]]];

NSString * html = [NSString stringWithContentsOfURL: url encoding:NSUTF8StringEncoding error:nil];

[webView.mainFrame loadHTMLString: html baseURL: url];

They also have lots of formats pre-defined, so it works quite well. The one issue I have found with this, is that the native Find dialog does not work when in the context of the WebView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜