2

I have a UIView in a UIScrollView. The UIScrollView only scrolls vertically, and doesn't zoom.

In the UIView's drawRect: method I'm trying to color the background and draw some text. When the text's relatively short both operations work fine. When the text's longer however, the UIView becomes so large that both operations silently fail. With long text the CGContext is around 640x17278 device pixels, which I guess is too big for the GPU/whatever to handle.

What's the best way to go about breaking the CALayer into multiple contexts to render into?

I've actually dealt with a very similar problem before and i went with CATiledLayer, but I remember it being a pain to work with and there being a noticeable delay between a tile appearing and it being rendered. Are there any other ways I could go about doing it?

The text is already laid out at this stage, it's just a matter of calling CGContextSetTextPosition and CTLineDraw for each line.

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
Max
  • 2,760
  • 1
  • 28
  • 47

0 Answers0