Search code examples
iosuiviewanimationuiviewanimationtransition

UIView animatewithduration - iOS


I'm trying to move a label from point A to point B using UIView animateWithDuration as below

    [UIView animateWithDuration:3 delay:0 options:UIViewAnimationTransitionNone animations:^(void){
        label.alpha = 1;
        label.center = CGPointMake(label.center.x , label.center.y +740);

        }completion:^(BOOL Finished){ 
         label.alpha = 0;
        label.center = CGPointMake(label.center.x , label.center.y - 740);]

Once the label is about to reach 740, it decelrates. Is it possible to have uniform motion to point B instead of slowing down?


Solution

  • Use this:

    [UIView animateWithDuration:3 delay:0 options:UIViewAnimationTransitionNone | UIViewAnimationOptionCurveLinear animations:^(void){ 
    ...