UIScrollView setZoomScale not working ?

Posted by iFloh on Stack Overflow See other posts from Stack Overflow or by iFloh
Published on 2010-04-13T11:53:24Z Indexed on 2010/04/13 17:33 UTC
Read the original article Hit count: 651

Filed under:
|
|

Hi,

I am struggeling with my UIScrollview to get it to zoom-in the underlying UIImageView. In my view controller I set

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
 return myImageView;
}

In the viewDidLoad method I try to set the zoomScale to 2 as follows (note the UIImageView and Image is set in Interface Builder):

- (void)viewDidLoad {
 [super viewDidLoad];

 myScrollView.contentSize = CGSizeMake(myImageView.frame.size.width, myImageView.frame.size.height);
 myScrollView.contentOffset = CGPointMake(941.0, 990.0);
 myScrollView.minimumZoomScale = 0.1;
 myScrollView.maximumZoomScale = 10.0;
 myScrollView.zoomScale = 0.7;
 myScrollView.clipsToBounds = YES;
 myScrollView.delegate = self;

 NSLog(@"zoomScale: %.1f, minZoolScale: %.3f", myScrollView.zoomScale, myScrollView.minimumZoomScale);
}

I tried a few variations of this, but the NSLog always shows a zoomScale of 1.0.

Any ideas where I screw this one up?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa-touch