I am facing the problem of getting the correct UIScrollView update in response to changing the minimum zoom scale.
The scrollview has a UIImageView as a preview, and the UIImageView image property is set in response to the didFinishPickingMediaWithInfo UIPickerView method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *takenImage = [info objectForKey:UIImagePickerControllerOriginalImage];
[self.imageView setImage:takenImage];
[self.imageView setFrame:CGRectMake(self.imageView.frame.origin.x, self.imageView.frame.origin.y, takenImage.size.width, takenImage.size.height)];
[self.scrollView setContentSize:CGSizeMake(takenImage.size.width, takenImage.size.height)];
[self.scrollView setMinimumZoomScale:[self.scrollView frame].size.width / takenImage.size.width];
[self.scrollView setMaximumZoomScale:2.0];
[self.scrollView setZoomScale:[self.scrollView minimumZoomScale] animated:YES];
[self dismissModalViewControllerAnimated:YES];
}
This works correctly when you first add an image using this method. However, if this method starts again - even to add the same image as for the first time - the subsequent image is displayed in full size in scrollView and cannot be reduced - only enlarged.
I dropped the contentSize, zoomScale, minimumZoomScaleand maximumZoomScalescrollView logged, and every time they are the same. minimumZoomScalecounted correctly every time.
scrollView minimumZoomScale 1.0, , . - , ?