I have a probem with iOS 5. The application crashes when it tries to execute [scrollView1 setZoomScale:1.1 animated:NO];. This is happening only in iOS 5. The code works correctly in all previous versions of iOS. The application crashes on simulator. I have not yet tried on Device.
Code is simple as below:
// choose minimum scale so image width fits screen
float minScale = [scrollView1 frame].size.width / ([scrollView1 frame].size.width-200);
[scrollView1 setMinimumZoomScale:minScale];
scrollView1.maximumZoomScale = 3;
scrollView1.minimumZoomScale = 0.5;
[scrollView1 setZoomScale:1.1 animated:NO];
[scrollView1 setContentOffset:CGPointZero];
The crash is happening when it calls a delegate method which returns.
scrollview object:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return scrollView;
}
If I comment setZoomScale then crash goes away. Please help if there is any workaround.
After testing found that it was also crashing on Device with iOS5. Finally I have created a view and placed it inside the ScrollView and in viewForZoomingInScrollView returned the new view for zooming. I think this is a workaround for now.