Type Method


Sets whether the animation should begin playing from the current state.


class func setAnimationBeginsFromCurrentState(_ fromCurrentState: Bool)



Specify true if animations should begin from their currently visible state; otherwise, false.


If set to true when an animation is in flight, the current view position of the in-flight animation is used as the starting state for the new animation. If set to false, the in-flight animation ends before the new animation begins using the last view position as the starting state. This method does nothing if an animation is not in flight or invoked outside of an animation block. Use the beginAnimations(_:context:) class method to start and the commitAnimations() class method to end an animation block. The default value is false.

Use of this method is discouraged in iOS 4.0 and later. Instead, you should use theanimate(withDuration:delay:options:animations:completion:) method to specify your animations and the animation options.

See Also

Animating Views

class func beginAnimations(String?, context: UnsafeMutableRawPointer?)

Marks the beginning of a begin/commit animation block.

class func commitAnimations()

Marks the end of a begin/commit animation block and schedules the animations for execution.

class func setAnimationStart(Date)

Sets the start time for the current animation block.

class func setAnimationsEnabled(Bool)

Sets whether animations are enabled.

class func setAnimationDelegate(Any?)

Sets the delegate for any animation messages.

class func setAnimationWillStart(Selector?)

Sets the message to send to the animation delegate when the animation starts.

class func setAnimationDidStop(Selector?)

Sets the message to send to the animation delegate when animation stops.

class func setAnimationDuration(TimeInterval)

Sets the duration (measured in seconds) of the animations in an animation block.

class func setAnimationDelay(TimeInterval)

Sets the amount of time (in seconds) to wait before animating property changes within an animation block.

class func setAnimationCurve(UIViewAnimationCurve)

Sets the curve to use when animating property changes within an animation block.

class func setAnimationRepeatCount(Float)

Sets the number of times animations within an animation block repeat.

class func setAnimationRepeatAutoreverses(Bool)

Sets whether the animations within an animation block automatically reverse themselves.

class func setAnimationTransition(UIViewAnimationTransition, for: UIView, cache: Bool)

Sets a transition to apply to a view during an animation block.

class var areAnimationsEnabled: Bool

Returns a Boolean value indicating whether animations are enabled.