It is interesting. According to the printout of the following - (void)scrollViewDidZoom:(UIScrollView *)scrollView contentSize is actually scrollview.frame.size x scrollview.zoomScale .
- (void)scrollViewDidZoom:(UIScrollView *)scrollView { if ([self.scrollView zoomScale] < 1.0)[self.scrollView setZoomScale:1.0]; NSLog (@"didZoom: ZoomScale: %.2f; ContentSize: %@; ScrollView: %@", self.scrollView.zoomScale, NSStringFromCGSize(self.scrollView.contentSize),NSStringFromCGSize(self.scrollView.frame.size)); }
Two prinout lines:
didZoom: ZoomScale: 1.76; ContentSize: {1798.02, 1208.05}; ScrollView: {1024, 688}
didZoom: ZoomScale: 1.50; ContentSize: {1537.94, 1033.3}; ScrollView: {1024, 688}
I did not find this "function" in the documentation.
Edit : I also tried the following:
-(void) manualSettingOfContentSizeAndZoomScale { NSLog (@"A: ZoomScale: %.2f; ContentSize: %@; ScrollView: %@", self.scrollView.zoomScale, NSStringFromCGSize(self.scrollView.contentSize),NSStringFromCGSize(self.scrollView.frame.size)); self.scrollView.contentSize = CGSizeMake(1800.0,1200.0); NSLog (@"B: ZoomScale: %.2f; ContentSize: %@; ScrollView: %@", self.scrollView.zoomScale, NSStringFromCGSize(self.scrollView.contentSize),NSStringFromCGSize(self.scrollView.frame.size)); self.scrollView.zoomScale = 1.8; NSLog (@"C: ZoomScale: %.2f; ContentSize: %@; ScrollView: %@", self.scrollView.zoomScale, NSStringFromCGSize(self.scrollView.contentSize),NSStringFromCGSize(self.scrollView.frame.size)); self.scrollView.contentSize = self.scrollView.frame.size; NSLog (@"D: ZoomScale: %.2f; ContentSize: %@; ScrollView: %@", self.scrollView.zoomScale, NSStringFromCGSize(self.scrollView.contentSize),NSStringFromCGSize(self.scrollView.frame.size)); }
The result is:
A: ZoomScale: 1.00; ContentSize: {0, 0}; ScrollView: {1024, 688}
B: ZoomScale: 1.00; ContentSize: {1800, 1200}; ScrollView: {1024, 688}
C: ZoomScale: 1.80; ContentSize: {1843.2, 1238.4}; ScrollView: {1024, 688}
D: ZoomScale: 1.80; ContentSize: {1024, 688}; ScrollView: {1024, 688}
A: OK, he documented that the default value of contentSize is CGSizeZero (although scrollView usually shows its contents in zoomScale 1.0
B: after setting contentSize zoomScale did not change, zoomScale also did not appear
C: after setting zoomScale contentSize and appearance changed accordingly
D: after resetting contentSize nothing has changed - contentSize , since the property has changed, but did not affect the appearance
Conclusion: use zoomScale to set the appearance of scrollView content
If memory suits me, contentSize is really important for scrolling UIScrollView with pagingEnabled set to YES . This is a rather complex object, so perhaps everything is not connected in the way you might think or want.