不糟糕的 UITextViews

发布于 2024-08-22 08:29:51 字数 398 浏览 3 评论 0原文

我希望非常戏剧性地自定义 UITextView 的行为 - 添加基于正则表达式的突出显示、行号以及查找和替换 - 因为我本质上想在 iPhone/iPad 上创建一个文本编辑器。

我一直在浏览 UITextView 参考< /a> 但它似乎非常受限制,根本不是非常可定制的。我不太了解底层框架,所以任何帮助将不胜感激。尽管我缺乏深入的知识,但我想做一些非常先进的事情,因此任何帮助都将非常感激。

我最好的,

杰米

I'm looking to customise the behaviour of a UITextView quite dramatically - adding in regex-based highlighting, line numbers and find and replace - as I essentially want to create a text editor on the iPhone/iPad.

I've been looking through the UITextView reference but it seems to be very restricted, not very customisable at all. I don't really know the underlying frameworks very well, so any help would be appreciated. My lack of in-depth knowledge notwithstanding, I want to do something pretty advanced, so any help at all would be really really appreciated.

My best,

Jamie

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久伴你 2024-08-29 08:29:51

不幸的是,您在 UITextView 中看到的正是您所得到的。它并非旨在支持您所描述的功能类型。

在最新的 iPhone 操作系统中,最好的选择是在 UIWebView 中部署基于 Javascript 的编辑器。在JS中进行文本处理。是的,这可能没什么乐趣,但与 UITextView 不同的是,它实际上是可能的。

或者从头开始编写您自己的文本视图。再说一次,这没什么乐趣,但好处是可以实现。

如果您可以访问未来 iPhone 操作系统的预发布版本,请留意新的改进和功能。 Apple 的 iPad 版 Pages 演示显然使用了比当前 UITextView 更复杂的东西,而 iWork 应用程序据说只使用公共 API。这意味着未来版本中将提供更接近您需要的功能。

Unfortunately what you're seeing with UITextView is exactly what you get. It's not designed to support the kind of features you describe.

In the latest iPhone OS your best bet would be to deploy a Javascript-based editor in a UIWebView. Do the text handling in JS. Yeah, that's probably no fun, but unlike UITextView it's actually possible.

Alternately code your own text view from the ground up. Again, no fun, but has the benefit of being possible.

If you have access to pre-releases of future iPhone OSs, watch for new improvements and features. Apple's demo of Pages for iPad clearly uses something more sophisticated than the current UITextView, and the iWork apps supposedly use only public APIs. That would imply something closer to what you need will be available in a future release.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文