Animation Blocks resets to original position after updating text

后端 未结 2 1758
清歌不尽
清歌不尽 2020-12-10 12:05

I\'m currently testing my apps for the release of IOS 8. I noticed that after I performed an animation block, the animation resets if I update the text of any label. I ran a

2条回答
  •  有刺的猬
    2020-12-10 12:37

    Try this. Put the desired animation in the finish block also.

        - (IBAction)move:(id)sender {
    
        [UIView animateWithDuration:0.4 delay:0.0
                         options:UIViewAnimationOptionBeginFromCurrentState
                         animations:^{
    
    
    self.myButton.center = CGPointMake(200, 300);
                     }completion:^(BOOL finished){
    
    
    
             if(finished){
                             self.myLabel.text=@"moved";
     self.myButton.center = CGPointMake(200, 300);
                         }
    
                     }];
    }
    

提交回复
热议问题