I am zooming on an image inside my scroll view.. But my scroll view has a background that I want to keep in sync with the foreground image.
This is what I have at the moment. I am wondering if I have to return bgImage in the viewForZoomingInScrollView method as well.. But Im just not really sure how or if its even possible to active.
This is what I have done below to get the image to zoom.. if anyone could help me figure out how to get the bg to scroll in sync also that would be greatly appreciated.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
scrollView.backgroundColor = [UIColor blackColor];
scrollView.delegate = self;
scrollView.bounces = NO;
scrollView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"auckland-300.jpg"]];
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"249a-134206f1d00-1342071f5d9.ImgPlayerAUCKLAND.png"]];
scrollView.contentSize = image.frame.size;
[scrollView addSubview:image];
scrollView.minimumZoomScale = 1.0;
scrollView.maximumZoomScale = 31.0;
[scrollView setZoomScale:scrollView.minimumZoomScale];
self.view = scrollView;
}
#pragma Zooming
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return image;
}
I assume you mean you want the background image to also zoom? What I would do is to use a
UIImageViewfor the background image as well and put that image and also yourimageinto a container view and return that inviewForZoomingInScrollView:. So something along these lines: