Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way of changing the duration of zoomToRect for UIScrollView?

Is there any way to specify a duration for the animation of [UIScrollView zoomToRect:zoomRect animated:YES]?

At the moment it's either fast animated:YES or instant animated:NO.

I'd like to specify a duration, eg [UIScrollView setAnimationDuration:2]; or something similar.

Thanks in advance!

like image 442
ayreguitar Avatar asked Jul 13 '10 15:07

ayreguitar


1 Answers

Use the UIView's animations.

It's a bit long to explain, so I hope this little example will clear things up a bit. Look at the documantation for further instructions

[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDuration: 2];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(revertToOriginalDidStop:finished:context:)];

expandedView.frame = prevFrame;

[UIView commitAnimations];

It's from a project I'm currently working on so it's a bit specific, but I hope you can see the basics.

like image 133
tadejsv Avatar answered Nov 01 '22 16:11

tadejsv