views:

47

answers:

1

Hi all,

Im using CoreText to display some text, creating framesetter, frames and so, and everything is fine. I can even format the text, but this all is done before I draw. Now the question that is driving me crazy:

CoreText is just to render text? I cannot get any reference to CTRuns or Glyphs to highlight them?

Another sub big question, the Pages App dont use CoreText, anyone knows? In Pages, you can select any already drawn styled text!

All I want is to draw the text and be able to let the user tap to select any text or doubleTap to select the paragraph.

Please, anyone, any light?

Thanks in advance.

+1  A: 

CoreText is just to render text. Implementing user interaction is quite another matter. You need to implement UITextInput protocol, see here. It's a big job.

If you just want to input text and don't have a need for advanced typography, just use UITextView or UIWebView.

Yuji
Hum, in fact I just wanna draw the text with CoreText, but give the user the ability to select any text... I know that I can draw glyphs and their background simulating a selection, but I need to do it based on user touches, reaching the rights characters, words and lines...
Daniel Bonates
Unfortunately there's no ready-made view which does that either. You need to work hard. I guess Pages has internally a very nice class which does that, but that's not yet publicly available in iOS 3.2. Let's hope that'll come with iOS 4 for iPad.
Yuji
@Yuji - It has been stated that the iWork applications all only use publicly available APIs to do what they do, so this would be an implementation internal to Pages, not the OS. However, yes, it would be nice if some of this worked its way from Pages back into the OS.
Brad Larson
That's what I meant, thanks for the clarification. Honestly I think Apple has every right to use a private framework on its own apps, while prohibiting us from using them, because they know which part they need to rewrite when the private frameworks change.
Yuji