UIScrollView zoomScale
@property(nonatomic) float zoomScale
Discussion of [UIScrollView zoomScale]
This value determines how much the content is currently scaled. The default value is 1.0.
UIScrollView zoomScale example.
You should use a different UIScrollViewDelegate method.
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
// Your code here
float scale = [scrollView zoomScale];
[self updateAuxViewScale:scale];
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
// Your code here
float scale = [scrollView zoomScale];
[self updateAuxViewScale:scale];
}
Example of [UIScrollView zoomScale].
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
//reset zoomScale back to 1 so that contentSize can be modified correctly
self.scrollView.zoomScale = 1;
// reset scrolling area equal to size of image
self.scrollView.contentSize = self.imageView.image.size;
//reset the image frame to the size of the image
self.imageView.frame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
//set the zoomScale to what we actually want
self.scrollView.zoomScale = [self findZoomScale];
}
{
//reset zoomScale back to 1 so that contentSize can be modified correctly
self.scrollView.zoomScale = 1;
// reset scrolling area equal to size of image
self.scrollView.contentSize = self.imageView.image.size;
//reset the image frame to the size of the image
self.imageView.frame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
//set the zoomScale to what we actually want
self.scrollView.zoomScale = [self findZoomScale];
}
UIScrollView zoomScale example.
When you do a block animation like in your code:
[UIView animateWithDuration:4.0
animations:^ {
self.scrollView.zoomScale = 0.5;
}
completion:nil];
[UIView animateWithDuration:4.0
animations:^ {
self.scrollView.zoomScale = 0.5;
}
completion:nil];