MDCActivityIndicator

@interface MDCActivityIndicator : UIView

A Material Design activity indicator.

The activity indicator is a circular spinner that shows progress of an operation. By default the activity indicator assumes indeterminate progress of an unspecified length of time. In contrast to a standard UIActivityIndicator, MDCActivityIndicator supports showing determinate progress and uses custom Material Design animation for indeterminate progress.

See https://material.io/go/design-progress-indicators

  • The callback delegate. See @c MDCActivityIndicatorDelegate.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<MDCActivityIndicatorDelegate>
        delegate;
  • Whether or not the activity indicator is currently animating.

    Declaration

    Objective-C

    @property (getter=isAnimating, assign, readwrite, nonatomic) BOOL animating;
  • Spinner radius width. Defaults to 12dp (24x24dp circle), constrained to range [5dp, 72dp]. The spinner is centered in the view’s bounds. If the bounds are smaller than the diameter of the spinner, the spinner may be clipped when clipToBounds is true.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat radius;
  • Spinner stroke width. Defaults to 2dp.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat strokeWidth;
  • Show a faint ink track along the path of the indicator. Should be enabled when the activity indicator wraps around another circular element, such as an avatar or a FAB. Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL trackEnabled;
  • The mode of the activity indicator. Default is MDCActivityIndicatorModeIndeterminate. If currently animating, it will animate the transition between the current mode to the new mode.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MDCActivityIndicatorMode indicatorMode;
  • Set the mode of the activity indicator. If currently animating, it will animate the transition between the current mode to the new mode. Default is MDCActivityIndicatorModeIndeterminate with no animation.

    Declaration

    Objective-C

    - (void)setIndicatorMode:(MDCActivityIndicatorMode)mode animated:(BOOL)animated;
  • Progress is the extent to which the activity indicator circle is drawn to completion when indicatorMode is MDCActivityIndicatorModeDeterminate. Progress is drawn clockwise to complete a circle. Valid range is between [0-1]. Default is zero. 0.5 progress is half the circle. The transitions between progress levels are animated.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) float progress;
  • Set the determinate progress of the activity indicator when indicatorMode is MDCActivityIndicatorModeDeterminate.

    Declaration

    Objective-C

    - (void)setProgress:(float)progress animated:(BOOL)animated;
  • The array of colors that are cycled through when animating the spinner. Populated with a set of default colors.

    Note

    If an empty array is provided to this property’s setter, then the provided array will be discarded and an array consisting of the default color values will be assigned instead.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nonnull) NSArray<UIColor *> *cycleColors;
  • Starts the animated activity indicator. Does nothing if the spinner is already animating.

    Declaration

    Objective-C

    - (void)startAnimating;
  • Starts the animated activity indicator after performing the provided transition. The animation cycle will begin on the cycleStartIndex provided. The startTransition will be applied with the starting and ending positions of the indicator stroke at the moment when the animation will begin taking into account the provided cycleStartIndex in the range [0,1]. The indicatorMode must be MDCActivityIndicatorModeIndeterminate before calling.

    Declaration

    Objective-C

    - (void)startAnimatingWithTransition:
                (nonnull MDCActivityIndicatorTransition *)startTransition
                         cycleStartIndex:(NSInteger)cycleStartIndex;
  • Stops the animated activity indicator with a short opacity and stroke width animation. Does nothing if the spinner is not animating.

    Declaration

    Objective-C

    - (void)stopAnimating;
  • Stops the animated activity indicator and then performs the provided transition. The provided stopTransition will be called with the starting and ending positions of the indicator stroke at the moment when the animation will begin in the range [0,1]. The indicatorMode must be MDCActivityIndicatorModeIndeterminate before calling.

    Declaration

    Objective-C

    - (void)stopAnimatingWithTransition:
        (nonnull MDCActivityIndicatorTransition *)stopTransition;