Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top