I would like to develop a text editor app in iOS for iPad.
I need some features like syntax coloring and auto-completion.
I am thinking about making my own subclass of UIView
or UIControl
.
I would like to know where to start painting the text with different colors.
If I override the drawRect
function, will I have any performance issue?
I mean that I can draw text in drawRect
with NSString
's UIKit
addition, such as drawInRect
.
If it is really required to use other techniques for text rendering, where shall I start?
Asked
Active
Viewed 101 times
0

jscs
- 63,694
- 13
- 151
- 195

Richard Dong
- 704
- 1
- 7
- 13
-
http://stackoverflow.com/questions/3642540/uitextview-with-syntax-highlighting – danh Nov 25 '13 at 03:00
1 Answers
-1
In general you want to avoid overriding drawRect. It does tend to cause reduced performance. Better to use system objects and let them take care of the rendering.
Apple has started adding support for attributed strings to view objects like UITextView. You could probably come up with a way to use a UITextView to display your styled/colored text.
Failing that yo'll probably have to use the CoreText framework.

Duncan C
- 128,072
- 22
- 173
- 272