Where does 32px come from? Is this related to your left and right scrollView margin?
Does the error persist with every page change? In this case, you should look at your scrollView contentInsets.
Otherwise, what I am doing to control the rotation on a scrollView with paging is to view the scrollView contentSize:
First, when you load the view, add an observer:
[self.scrollView addObserver:self forKeyPath:NSStringFromSelector(@selector(contentSize)) options:0 context:nil];
Then, when the contentSize value changes, configure contentOffset:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (object == self.scrollView && [keyPath isEqualToString:NSStringFromSelector(@selector(contentSize))]) {
Finally, remove the observer when unloading scrollView:
[self.scrollView removeObserver:self forKeyPath:NSStringFromSelector(@selector(contentSize)) context:nil];
source share