iPad: Move UIView with animation, then move it back

前端 未结 2 497
后悔当初
后悔当初 2021-02-11 03:06

I have the following code in a UIView subclass that will move it off the screen with an animation:

float currentX = xposition; //variables that store where the U         


        
2条回答
  •  你的背包
    2021-02-11 03:41

    Assigning to a transform will cause the old one to disappear. To return to the original position, assign the identity transform to it.

    self.transform = CGAffineTransformIdentity;
    

    (Or better, just change the .frame instead of changing the .transform.)

提交回复
热议问题