Since iOS 5 you can use a UIWebView and set contenteditable="true"
on a div in it. This makes the UIWebView open a keyboard up and allow the user to directly input text into the DOM. You can then write a webapp that does syntax highlighting. You can communicate with the cocoa app with custom URLs.//
通过webview来进行编辑,通过DOm,然后后台的提交,要host一个小型的web site
https://github.com/aleph7/a-coding/tree/master/SyntaxHighlightingDemo
http://www.a-coding.com/2012/03/syntax-highlighting-in-ios.html
https://github.com/sakrist/SUITextView//
http://www.oschina.net/p/syntaxhighlighter----use script in webview
可以尝试使用这个脚本:https://github.com/alexgorbatchev/SyntaxHighlighter,一直在保持更新,程序语言,目前也是使用了webview的方式在浏览,只需要加入脚本库,进行render。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>SyntaxHighlighter TypeScript Test</title>
<script type="text/javascript" src="../scripts/XRegExp.js"></script>
<script type="text/javascript" src="../scripts/shCore.js"></script>
<script type="text/javascript" src="../scripts/shBrushTypeScript.js"></script>
<link type="text/css" rel="stylesheet" href="../styles/shCore.css"/>
<link type="text/css" rel="Stylesheet" href="../styles/shThemeVisualStudio.css" />
<script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body>
<h1>SyntaxHighlighter TypeScript Language Demo</h1>
<script type="syntaxhighlighter" class="brush: typescript;">