iPad: Move UIView with animation, then move it back

前端 未结 2 2038
一个人的身影
一个人的身影 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

    UIView transform isn't additive; I suggest that to move it back you instead do:

    self.transform = CGAffineTransformIdentity;
    

    The docs say (about updating the frame):

    "Warning: If this property is not the identity transform, the value of the frame property is undefined and therefore should be ignored."

提交回复
热议问题