0

I want to ask how to set the size of the white space in CoreText? I want to make the CoreText white space have same size with UITextView white space. Anybody can help me?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Rizki
  • 281
  • 1
  • 6
  • 19
  • Is this perhaps related to your previous question - http://stackoverflow.com/questions/4569190/how-to-set-tab-stop-in-coretext If so, please update that question rather than create a new one. – John Parker Dec 31 '10 at 09:50

1 Answers1

1

You are unlikely to ever get this QUITE right. Using the debugger/Instruments you can see that UITextViews draw their text using WebKit, which puts a very big "black box" between what you can control on the UITextView itself and the underlying, highly generalized text-drawing code it eventually uses for drawing. What's more, Apple can change the behavior of UITextView and make it different from your CoreText-drawn text in the future. Having tried to achieve the exact same effect myself, I can tell you that down this road lies only pain. I would strongly suggest taking an alternate approach.

If your goal is to have the text rendering between a custom view and a UITextView line up perfectly, and you MUST use the UITextView, I would suggest looking into using WebKit for text rendering in your custom view, instead of going to CoreText directly. But no matter what way you do it, you're looking at a lot of work, and you're implicitly depending on Apple to not tweak their text rendering in the future.

Good luck.

ipmcc
  • 29,581
  • 5
  • 84
  • 147