Animate changes to one or more views using the specified duration.
SDKs
- iOS 4.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
class func animate(withDuration duration: Time Interval, animations: @escaping () -> Void)
Parameters
duration
The total duration of the animations, measured in seconds. If you specify a negative value or
0
, the changes are made without animating them.animations
A block object containing the changes to commit to the views. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be
NULL
.
Discussion
This method performs the specified animations immediately using the curve
and transition
animation options.
During an animation, user interactions are temporarily disabled for the views being animated. (Prior to iOS 5, user interactions are disabled for the entire application.)