AMLoadingSpinner
是显示正在执行的任务进度的一个简单的方法来展示动画旋转器。
将 AMLoadingSpinner/AMLoadingSpinner
文件夹拖入您的项目。
AMLoadingSpinner
是一个单例,它将始终作为应用程序主窗口的全屏子视图来显示。这个旋转器没有默认的动画,因此您需要有一组动画图片(图片数组的序列)来使用它。
+(void) setAnimationImages:(NSArray <UIImage *>*)images;
您可以通过此方法传递一个包含单个对象数组的参数来获取不带动画的静态图像。
+(void) setAnimationDuration:(NSTimeInterval)duration; // Default is 5.0 seconds
+(void)setForegroundImageViewSize:(CGSize)size; // Default is (100, 100)
请注意,旋转器始终显示在屏幕中间。
您可以选择旋转器背景视图的类型。背景类型是枚举 AMLoadingSpinnerBackgroundType
,它有 4 个值
AMLoadingSpinnerBackgroundTypeFullScreen // Full-screen background view
AMLoadingSpinnerBackgroundTypeClear // Background view is not shown
AMLoadingSpinnerBackgroundTypeDefaultView // Background view is rectangle or square
AMLoadingSpinnerBackgroundTypeCustomView // Custom background view
您可以使用以下方法自定义背景视图
+(void) setBackgroundType:(AMLoadingSpinnerBackgroundType)type; // Default is AMLoadingSpinnerBackgroundTypeClear
//Works ONLY when for AMLoadingSpinnerBackgroundTypeCustomView type
+(void) setBackgroundView:(UIView *)view;
//Works ONLY when for AMLoadingSpinnerBackgroundTypeDefaultView type
+(void) setBackgroundViewSize:(CGSize)size; // Default is (200, 200)
+(void) setBackgroundViewCornerRadius:(CGFloat)radius; // Default is 10.0
//Works ONLY when for AMLoadingSpinnerBackgroundTypeDefaultView and AMLoadingSpinnerBackgroundTypeFullScreen types
+(void) setBackgroundViewColor:(UIColor *)color; // Default is (255, 255, 255, 0.7)
要显示/隐藏旋转器,请使用以下方法
+(void) show;
+(void) showWithProgress:(CGFloat)progress;
+(void) dismiss;
+(void) dismissWithDelay:(NSTimeInterval)delay;
注意,在旋转器显示时,用户与应用程序的交互将禁用。
AMLoadingSpinner
在 MIT 许可证 的条款和条件下分发。
AMLoadingSpinner
由 Artem Mihaylov 开发。如果您在项目中使用了 AMLoadingSpinner
,对软件归属的认可将会非常感激。