iPad: Move UIView with animation, then move it back

前端 未结 2 496
后悔当初
后悔当初 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:27

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

提交回复
热议问题