Type Method


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


class func setAnimationRepeatCount(_ repeatCount: Float)



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.


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

Related Symbols

class func setAnimationDuration(TimeInterval)

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

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

Marks the beginning of a begin/commit 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 commitAnimations()

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

class func setAnimationRepeatAutoreverses(Bool)

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

class func setAnimationStart(Date)

Sets the start time for the current animation block.

class func setAnimationCurve(UIViewAnimationCurve)

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

class func setAnimationBeginsFromCurrentState(Bool)

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