Sets whether the animations within an animation block automatically reverse themselves.
- iOS 2.0–13.0Deprecated
- tvOS 9.0–13.0Deprecated
trueto enable autoreversing or
falseto disable it.
If you enable autoreversing, a single animation cycle changes the properties being animated to their new values and then back to their original values. At the end of the animations, the affected views are then updated immediately to reflect the new values. This method does nothing if called from outside of an animation block. By default, autoreversing is disabled.
If you combine autoreversing with a repeat count (settable using the
set method), you can create animations that shift back and forth between the old and new values the specified number of times. However, remember that the repeat count indicates the number of complete cycles. If you specify an integral value such as
2, the animation ends on the old value, which is followed by the view immediately updating itself to show the new value, which might be jarring. If you want the animation to end on the new value (instead of the old value), add
0 to the repeat count value. This adds an extra half cycle to the animation.
Use of this method is discouraged in iOS 4.0 and later. Instead, you should use the
animate(with method to specify your animations and the animation options.