You can control the size of the content using the scroll contentSize property. If this is not enough for you (for example, you need to limit the scroll area to some arbitrary area in the middle of your content), you can make contentOffset be in the required limit in the delegate method of your scroll view.
Basically, the code might look like this:
- (void) scrollViewDidScroll:(UIScrollView*)scroll{ CGPoint offset = scroll.contentOffset; // Check if current offset is within limit and adjust if it is not if (offset.x < minOffsetX) offset.x = minOffsetX; if (offset.y < minOffsetY) offset.y = minOffsetY; if (offset.x > maxOffsetX) offset.x = maxOffsetX; if (offset.y > maxOffsetY) offset.y = maxOffsetY; // Set offset to adjusted value scroll.contentOffset = offset; }
Vladimir
source share