I'm having issue with the zooming feature of UIScrollView. It does not work at all. I have read similar posts and none of the fixes others used seem to work for me. My viewController references UIScrollViewDelegate, I have an instance variable for UIScrollView, I declare my subview to be the delegate object of UIScrollView, and I have the implementation for (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
. Here's my loadView function:
(void)loadView
{
CGRect frame = CGRectMake(0, 0, 320, 480);
scrollView = [[UIScrollView alloc] initWithFrame:frame];
[scrollView setScrollEnabled:YES];
CGRect reallyBigRect;
reallyBigRect.origin = CGPointZero;
reallyBigRect.size.width = frame.size.width * 2.0;
reallyBigRect.size.height = frame.size.height * 2.0;
[scrollView setContentSize:reallyBigRect.size];
CGPoint offset;
offset.x = frame.size.width * 0.5;
offset.y = frame.size.height * 0.5;
[scrollView setContentOffset:offset];
[scrollView setMinimumZoomScale:1];
[scrollView setMaximumZoomScale:5];
[scrollView setUserInteractionEnabled:YES];
self.scrollView.delegate = self;
self.view = scrollView;
views = [[HypnosisView alloc] initWithFrame:reallyBigRect];
[scrollView addSubview:views];
[self.view setBackgroundColor:[UIColor clearColor]];
}
This code allows me to scroll just fine but zooming is nonexistent.
Hope to hear from someone, Dave