This topic describes the custom loading control in mPaaS and provides code examples.
AULoadingIndicatorView is the custom loading control provided by mPaaS.
It is migrated from APActivityIndicatorView in APCommonUI. Therefore, you should use AULoadingIndicatorView.
API reference
typedef enum{
AULoadingIndicatorViewStyleTitleBar, // Loads in the navigation bar. Diameter: 36 px. Ring width: 3 px.
AULoadingIndicatorViewStyleRefresh, // Loads when a list is refreshed. Diameter: 48 px. Ring width: 4 px.
AULoadingIndicatorViewStyleToast, // Loads in a toast message. Diameter: 72 px. Ring width: 6 px.
AULoadingIndicatorViewStyleLoading, // Loads on a page. Diameter: 90 px. Ring width: 6 px.
}AULoadingIndicatorViewStyle;
/**
mPaaS custom loading control
*/
@interface AULoadingIndicatorView : UIView
@property (nonatomic, assign) BOOL hidesWhenStopped; // Specifies whether to hide the control when the animation stops.
@property (nonatomic, strong) UIColor *trackColor; // The color of the ring.
@property (nonatomic, strong) UIColor *progressColor; // The color of the indicator.
@property (nonatomic, assign) float progressWidth; // The width of the ring. The default value is 2 when you customize the circle size.
@property (nonatomic, assign) CGFloat progress; // The ratio of the loading indicator's arc length to the ring. The default value is 0.1.
/**
* A circular loading box.
* Note: To customize the circle size instead of using a default style, use initWithFrame: for initialization. The ring width defaults to 2. Set progressWidth to adjust the width.
*
* @param style The current loading type.
*
*/
- (instancetype)initWithLoadingIndicatorStyle:(AULoadingIndicatorViewStyle)style;
/**
Starts the animation.
*/
- (void)startAnimating;
/**
Stops the animation.
*/
- (void)stopAnimating;
/**
Checks whether the animation is running.
@return YES if the animation is running. NO if the animation is not running.
*/
- (BOOL)isAnimating;
@endCode example
AULoadingIndicatorView *view = [[AULoadingIndicatorView alloc] initWithLoadingIndicatorStyle:AULoadingIndicatorViewStyleLoading];
view.hidesWhenStopped = YES;
view.center = CGPointMake(280, 250);
view.trackColor = [UIColor redColor];
view.progressColor = [UIColor blueColor];
[view startAnimating];
[self.view addSubview:view];