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