I'm adding two subviews in a UIScrollView centered on top of each other. My thought was when the user uses the the zoom gesture that both would stretch together but that is not the case. The imageview on top get's stretched and the image view on the bottom does nothing. How can I accomplish both imageviews to have the ability to zoom together.
- (void)applicationDidFinishLaunchingUIApplication *)application {
UIImage *image = [UIImage imageNamed:@"EngineSize_Base_Transparent.png"];
CGRect imageRect = CGRectMake(0.0, 0.0,IMAGE_WIDTH,0.0);
imageRect.size.height = IMAGE_WIDTH;// * image.size.height / image.size.width;
UIImageView *tempimageView= [[UIImageView alloc] initWithFrame:imageRect];
tempimageView.image = image;
tempimageView.center = CGPointMake(160.0,230.0);
[self setMyImageView:tempimageView];
[myScrollView addSubview:myImageView];
[tempimageView release];
image = [UIImage imageNamed:@"EngineSize_Rotator_Transparent.png"];
CGRect imageRect2 = CGRectMake(0.0, 0.0,IMAGE_WIDTH2,0.0);
imageRect2.size.height = IMAGE_WIDTH2;// * image.size.height / image.size.width;
tempimageView= [[UIImageView alloc] initWithFrame:imageRect2];
tempimageView.image = image;
tempimageView.center = CGPointMake(160.0,230.0);
[self setMyImageView:tempimageView];
[myScrollView addSubview:myImageView];
[tempimageView release];
myScrollView.contentSize = CGSizeMake(myImageView.frame.size.width, myImageView.frame.size.height);
myScrollView.maximumZoomScale = 5.0;
myScrollView.minimumZoomScale = 1.0;
myScrollView.contentSize = CGSizeMake(IMAGE_WIDTH + IMAGE_WIDTH2, IMAGE_WIDTH + IMAGE_WIDTH2);
myScrollView.clipsToBounds = YES;
myScrollView.delegate = self;
[window makeKeyAndVisible];
}