tags:

views:

149

answers:

1

I have problem understanding this in the documentation for UIScrollView:

"The object that manages the drawing of content displayed in a scroll view should tile the content’s subviews so that no view exceeds the size of the screen. As users scroll in the scroll view, this object should add and remove subviews as necessary."

Isn't the point of using scroll view is to manage subview that is larger than the containing scroll view?

A: 

This is done to limit the memory usage and other overhead when display huge amounts of data. Its the same reason the documentation for UITableView suggests that you reuse the cells that you provide to it.

Naren
thanks Naren. The thing I don't understand is, the content will only be scrolled if its size is larger than the frame, and for the content size to be larger, the subview must be larger than frame. That's why it doesn't make sense to me for the doc to say that the content's subviews should be tiled. Maybe I am not interpreting things correctly.
Boon
I would assume that the size of the tile you use is bigger than what can be displayed in one frame. So at any given time, you are really only scrolling within a tile. If however the user scrolls out of the bounds of the tile, you load a new tile. This is just so that you don't load a massive amount of data up front which is all sitting off screen and might never be seen.Think of the map application for example. It doesn't load the entire world map - it tiles it and displays only the ones that are needed.Hope that helps.
Naren