Re: Scroller With CATiledLayer Running out of Memory

2010-08-07 Thread Kyle Sluder
On Sat, Aug 7, 2010 at 8:19 PM, David Duncan wrote: > The simplest method would likely be to take the same approach that > UITableView takes. Create a subclass of UIScrollView that lays out some small > number of views that you render parts of your text into. This is very similar > to what Scro

Re: Scroller With CATiledLayer Running out of Memory

2010-08-07 Thread David Duncan
On Aug 7, 2010, at 11:51 AM, Gordon Apple wrote: > So, are you saying that the backing layer will always be the size of the > view? Or that there there will always be enough tiles to cover the view? A CALayer keeps a single backing store. By default the backing store created when -display is ca

Re: Scroller With CATiledLayer Running out of Memory

2010-08-07 Thread Gordon Apple
So, are you saying that the backing layer will always be the size of the view? Or that there there will always be enough tiles to cover the view? If that is the case, then it sounds like what you are advocating is to create my own scroller or somehow tie the scroller to another (overlaid) view wi

Re: Scroller With CATiledLayer Running out of Memory

2010-08-07 Thread David Duncan
On Aug 6, 2010, at 6:07 PM, Gordon Apple wrote: > I thought that was what the scroller was supposed to do for you, at least if > you actually optimized drawing to use the "rect" in drawRect, which is what > I am currently trying to do. That's how it works on AppKit in non-layer backed mode. In U

Re: Scroller With CATiledLayer Running out of Memory

2010-08-06 Thread Gordon Apple
I thought that was what the scroller was supposed to do for you, at least if you actually optimized drawing to use the "rect" in drawRect, which is what I am currently trying to do. I may have something else going on. The version in the app store works fine, but my current one is now crashing all

Re: Scroller With CATiledLayer Running out of Memory

2010-08-06 Thread David Duncan
On Aug 6, 2010, at 2:09 PM, Gordon Apple wrote: > BTW, the reason I went to a tiled layer in the first place is that CALayer > crapped out long before that and only allowed a fairly short document view > length. The trick is to do something similar to what UITableView does – (re)use a small set

Re: Scroller With CATiledLayer Running out of Memory

2010-08-06 Thread Gordon Apple
I chose 1024 width so that it would at least cover the (landscape) width, and not have to redraw the same line multiple times. The optimized drawing requires some computation itself, so I figured 512 was a good compromise that would require three tiles max per screen. Font size can go up to 192 p

Re: Scroller With CATiledLayer Running out of Memory

2010-08-06 Thread David Duncan
On Aug 6, 2010, at 12:29 PM, Gordon Apple wrote: > I'm having a major problem. If I scroll slowly, or in small jumps, no > problem. However, if I scroll fast over a longer length, the app terminates > with memory exceeded. I don't believe I have any significant leaks. This > doesn't happen in

Scroller With CATiledLayer Running out of Memory

2010-08-06 Thread Gordon Apple
I have a very long text view (CoreText) for iPad. It a CATiledLayer, 1024 x 512 tiles. I'm doing optimized drawing (first to last line) in drawRect, which gets called for each tile. I have a vertical slider that appears when you tap the right side in order to fast (live) scroll when needed. I'm