Type Method

setAnimationRepeatCount(_:)

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

Declaration

class func setAnimationRepeatCount(_ repeatCount: Float)

Parameters

repeatCount

The number of times animations repeat. This value can be a fraction. If you specify the value 0, the animation is performed once without repeating.

Discussion

Use this method to specify the number of times to repeat the specified animations. This method does nothing if called from outside of an animation block. You can use this method in conjunction with either the block-based methods or the begin/commit methods for defining an animation block. If you do not explicitly set a repeat count, the animation is not repeated.

If you pass the repeat option to the animate(withDuration:delay:options:animations:completion:) method without setting an explicit repeat count, the animation repeats indefinitely. If you want the animation to repeat a finite number of times, call this method from inside your block.

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 setAnimationRepeatAutoreverses(Bool)

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

class func setAnimationBeginsFromCurrentState(Bool)

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

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.