Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

amigo1

macrumors newbie
Original poster
Jan 3, 2011
1
0
I have a dot that's moving around the screen. As it exceeds the bound of the scroll view, a new tile is created that the dot can move onto and the size of the scroll view is increased. I keep track of this with:

scrollViewBounds = CGRectUnion(newTileBounds, scrollViewBounds);
[scrollView setContentSize:scrollViewBounds.size];


This works fine as long as the new tiles have a non-negative origin. If the newly created tiles are to the left border and have a negative origin, the bounds size will be compensated on the right side. I know that setContentSize only say how big the view will be, not where it is located.

So I tried using setContentOffset and that seemed to work choppily, but then if I scrolled, it would jump back to the positive area and you couldn't scroll to the negative region anymore.

The dot can move in an arbitrarily long distance in any direction so I can't predetermine a maximum size of the content view.

How do you make the tiles with negative origins be visible?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.