I have a UIScrollView (self.zoomScrollView) with another UIView (self.pageView) in it. I'm animating the zoomScale and contentOffset using
CGPoint p1 = [tap locationInView:self.pageView];
CGPoint p2 = CGPointMake(p1.x * 3, p1.y * 3);
CGPoint d = CGPointMake(p2.x - p1.x, p2.y - p1.y);
[UIView animateWithDuration:0.2
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
[self zoomScrollView].zoomScale = 3;
[self.zoomScrollView setContentOffset:d animated:NO];
}
completion:^(BOOL finished) {
}];
The first time this animation runs the contentOffset is set to its final value immediately and then the zoomScale is animated up to meet it. Every other time after that this animation works perfectly. Any ideas on why it doesn't work the first time?