动画是反向发生的

Animation is happening in reverse

我正在制作一个简单的动画,当点击一个按钮时,它会从当前位置变为某个点。但是发生的事情恰恰相反:它从目标点到原始位置。这是我的代码:

[UIView animateWithDuration:1.0
                          delay:0.0
         usingSpringWithDamping:0.2
          initialSpringVelocity:0.0
                        options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{
                         [self.view layoutIfNeeded];
                         CGFloat amount = 100;
                         self.checkButton.frame = CGRectOffset(self.checkButton.frame, amount, 0);                             
                     } completion:^(BOOL finished) {

                     }];

为确定 checkButton 的水平位置的约束创建一个出口。例如"hPos".

- (IBAction)tapHandler:(id)sender {
        self.hPos.constant = self.hPos.constant + 100;
        [UIView animateWithDuration:1.0
                              delay:0.0
             usingSpringWithDamping:0.2
              initialSpringVelocity:0.0
                            options:UIViewAnimationOptionBeginFromCurrentState
                         animations:^{ [self.view layoutIfNeeded]; }
                            completion:nil];

}