Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make UIView animation smoother?
    primarykey
    data
    text
    <p>I have a couple of gesture recognizers to swipe an image left-2-right or vv, depending on the direction of the swipe. But I want the animation to be smoother. This is my code so far:</p> <pre><code>-(void)swipeNext:(id)sender{ //0 Get the currentview as referenced by pageControl UIImageView *oldView = [views objectAtIndex:currentViewIndex]; //MOVE ON TO NEW VIEW currentViewIndex ++; NSLog(@"left swiped - currentViewIndex:%d", currentViewIndex); UIImageView *newView = [views objectAtIndex:currentViewIndex]; //NSLog(@"views objectAtIndex = %@",[views objectAtIndex:[self.pageControl currentPage]]); //1 Animate out the old view newView.frame = oldView.frame; newView.center = CGPointMake(oldView.center.x + CGRectGetWidth(oldView.frame), oldView.center.y); [oldView.superview addSubview: newView]; [UIView animateWithDuration:1.0 delay: 0.0 options: UIViewAnimationOptionCurveEaseIn //UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{ newView.center = oldView.center; oldView.center = CGPointMake(oldView.center.x - CGRectGetWidth(oldView.frame), oldView.center.y); } completion:nil]; } </code></pre> <p>Id like to make it a bit faster. Ive posted as reference to the app that im trying to emulate, DunkinDonuts (<a href="https://stackoverflow.com/questions/15330361/what-kind-of-viewcontrollers-does-the-dunkin-donuts-app-use">What kind of viewcontrollers does the Dunkin Donuts app use</a>) and they seem to use a UIPageControl, which I tried using at first but had trouble determining the direction of the swipe (<a href="https://stackoverflow.com/questions/15372190/how-do-i-animate-a-uiimageview-left-to-right-with-uipagecontrol">How do I animate a UIImageView left to right with UIPageControl?</a>), so I switched over to Gestures. But if you see their app, the swipe is faster.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload