I have a UIImageView within a UIScrollView and I can vertically scroll, but not horizontal scroll because of how I set the content size. That's exactly how I want.
However, I can't seem to zoom in and out. I set the minimum and maximum zoom scale, but it's not working.
Can someone tell me why?
Thanks.
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//self.scrollView.scrollEnabled = YES;
CGSize scrollableSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
[self.scrollView setContentSize:scrollableSize];
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"test.png"] ];
tempImageView.frame = CGRectMake(0, 0, self.scrollView.frame.size.width, self.view.frame.size.height);
self.scrollView.backgroundColor = [UIColor blackColor];
self.scrollView.minimumZoomScale = 1.0 ;
self.scrollView.maximumZoomScale = tempImageView.image.size.width / self.scrollView.frame.size.width;
self.scrollView.zoomScale = 1.0;
self.scrollView.delegate = self;
[self.scrollView addSubview:tempImageView];
}