移动开发平台 mPaaS mPaaS 自定义加载控件

By | 2021年4月23日
  • AULoadingIndicatorView 为 mPaaS 自定义的加载控件。
  • mPaaS 自定义加载控件迁移自 APCommonUI 的 APActivityIndicatorView,请使用 AULoadingIndicatorView。

效果图

auloadingindicatorview

接口说明

  
  1. typedef enum{
  2. AULoadingIndicatorViewStyleTitleBar, //导航栏加载,直径:36px,环宽:3px
  3. AULoadingIndicatorViewStyleRefresh, //列表刷新加载,直径:48px,环宽:4px
  4. AULoadingIndicatorViewStyleToast, //toast 加载,直径:72px,环宽:6px
  5. AULoadingIndicatorViewStyleLoading, //页面加载,直径:90px,环宽:6px
  6. }AULoadingIndicatorViewStyle;
  7. /**
  8. mPaaS 自定义加载控件
  9. */
  10. @interface AULoadingIndicatorView : UIView
  11. @property (nonatomic, assign) BOOL hidesWhenStopped; //是否停止的时候隐藏掉
  12. @property (nonatomic, strong) UIColor *trackColor; //圆环颜色
  13. @property (nonatomic, strong) UIColor *progressColor; //指示器颜色
  14. @property (nonatomic, assign) float progressWidth; //设置圆环的宽度,自定义圆圈大小时,默认为 2
  15. @property (nonatomic, assign) CGFloat progress; //加载指示器的弧长与圆环的比值,默认为 0.1
  16. /**
  17. * 圆圈样式的 loading 框
  18. * 说明:如果不使用默认 style,需要自定义圆圈的大小,请使用 initWithFrame: 初始化,此时圆环宽度默认为 2,可设置 progressWidth 调整
  19. *
  20. * @param style 当前 loading 类型。
  21. *
  22. */
  23. - (instancetype)initWithLoadingIndicatorStyle:(AULoadingIndicatorViewStyle)style;
  24. /**
  25. 开始执行动画
  26. */
  27. - (void)startAnimating;
  28. /**
  29. 停止执行动画
  30. */
  31. - (void)stopAnimating;
  32. /**
  33. 是否正在执行动画
  34. @return YES:动画执行中;NO:没有执行动画
  35. */
  36. - (BOOL)isAnimating;
  37. @end

代码示例

  
  1. AULoadingIndicatorView *view = [[AULoadingIndicatorView alloc] initWithLoadingIndicatorStyle:AULoadingIndicatorViewStyleLoading];
  2. view.hidesWhenStopped = YES;
  3. view.center = CGPointMake(280, 250);
  4. view.trackColor = [UIColor redColor];
  5. view.progressColor = [UIColor blueColor];
  6. [view startAnimating];
  7. [self.view addSubview:view];

请关注公众号获取更多资料

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注