tags:

views:

165

answers:

0

Hi,

I just created my own zooming implementation for UIScrollView,

-(void) scaleZoom:(float)zoomScale centeredAt:(CGPoint)centerPoint
{
   UIView *viewForZooming = [self.delegate viewForZoomingInScrollView:self];
   if (viewForZooming == nil)
      return;

   lcZoomScale = zoomScale;
   [UIView beginAnimations:nil context:viewForZooming];
   [UIView setAnimationDuration: 0.4];
   [UIView setAnimationDelegate: self];
   [UIView setAnimationDidStopSelector: @selector(zoomAnimationDidStop:finished:context:)];

   viewForZooming.transform =  CGAffineTransformMakeScale(zoomScale, zoomScale);

   CGSize zoomViewSize   = viewForZooming.frame.size;
   viewForZooming.frame = CGRectMake(0, 0, zoomViewSize.width, zoomViewSize.height);
   self.contentSize = zoomViewSize;
   self.contentOffset = centerPoint;
   [UIView commitAnimations];
}

-(void) zoomAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(UIView *)context
{

   [self.delegate scrollViewDidEndZooming:self withView:context atScale:lcZoomScale];
}

This zooming animation works but when the content view is completely zoom out, then I made an expand gesture, the content view will change to this 1.0 scale.

Did I missed something here?

Thanks