I am working on a real-time syntax highlighter for the iPhone and I have created a custom UIView that takes a string, parses it and then highlights it in its drawRect: method. I've also implemented a blinking cursor. However, it is starting to get a little slow and I think that when I implement multi-line processing and chunk-processing, it will slow it down more. However, I tried placing the [formattedTextView setNeedsDisplayInRect:]
call in a function in my view controller and then calling on a separate thread using [self performSelectorInBackground:@selector(updateDisplay) withObject:nil]
. The keyboard is more responsive now, but this seems like a bad use of threads on a single-core processor.
Are there any problems with doing something like this?
Thanks