phosphoer
phosphoer

Reputation: 443

ios scrolling over a large uiview memory problems

I'm making a music app that displays musical notation. Currently the notation is in a very large view that extends horizontally until the music ends. Obviously this isn't a good solution because I quickly run out of memory when display large scores of music.

My question is how I can implement my view such that the view where I do my drawing is only the size of the screen, but the content gets scrolled across it (The view is contained in a scrollview)? I imagine I could just only draw stuff on the screen and redraw the view as it gets scrolled with different x coordinates, but this seems ugly and would be pretty slow.

Thanks for any suggestions. : )

Upvotes: 1

Views: 509

Answers (1)

Martin Kenny
Martin Kenny

Reputation: 2488

There are a number of solutions around. Usually these involve drawing one-or-two screen widths past the edges, then scrolling as needed, and drawing again into the area that was previously visible. In essence, using the scroll-view as a circular buffer.

Try a Google search for UIScrollView infinite scroll.

Also, see Infinite horizontal scrolling UIScrollView.

Upvotes: 2

Related Questions