iPad: Move UIView with animation, then move it back

前端 未结 2 2021
一个人的身影
一个人的身影 2021-02-11 03:18

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:37

    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.)

提交回复
热议问题