UITextView w /语法高亮 [英] UITextView w/ Syntax Highlighting

查看:115
本文介绍了UITextView w /语法高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有Cocoa或Cocoa-Touch的通用库,解析器等,可以获取一大块文本,并进行正确的语法高亮?作为一个简单的例子,我想有一个UITextView具有C / C ++语法高亮。

解决方案

我编写了一个示例应用程序,语法高亮显示:



http://github.com/amcgregor/syntax-alpha p>

不幸的是我的目标是一个可编辑的语法高亮编辑器,但是contentEditable被禁用(我已经提交了一个与苹果的错误报告;它是一个特征回归) p>

更新:示例应用程序在Apple提交时被拒绝;他们声称有限功能。我回答说,它是一个语法高亮的源代码查看器与Safari和应用程序文件共享集成,并有十几个'屁应用程序'在商店。没有进来; P


Is there a common library, parser, etc. for Cocoa or Cocoa-Touch that can take a chunk of text and do the proper syntax highlighting? As a simple example, I'd like to have a UITextView that has C/C++ syntax highlighting.

解决方案

I've coded up a bit of an example application that does syntax highlighting:

http://github.com/amcgregor/syntax-alpha

Unfortunately my goal was for an editable syntax highlighting editor, but with contentEditable disabled (I've filed a bug report with Apple; it's a feature regression) I was hooped.

Update: The sample app was rejected by Apple when I submitted it; they claimed "limited functionality". I replied, "it's a syntax highlighting source code viewer with Safari and application filesharing integration, and there are a dozen 'fart apps' on the store." Didn't get in. ;P

这篇关于UITextView w /语法高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆