Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS zoomToRect with duration [duplicate]

Tags:

ios

scrollview

Possible Duplicate:
Any way of changing the duration of zoomToRect for UIScrollView?

Is there any way to replicate the behaviour of [UIScrollView zoomToRect:zoomRect animated:YES] such that the animation lasts for a given duration?

like image 807
silviupop Avatar asked Oct 10 '11 17:10

silviupop


1 Answers

You can put this in your UIScrollView subclass:

- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated
{
    [UIView animateWithDuration:(animated?0.3f:0.0f)
                          delay:0
                        options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{
                         [super zoomToRect:rect animated:NO];
                     } 
                     completion:nil];
}
like image 131
Damien Debin Avatar answered Oct 14 '22 05:10

Damien Debin