BALoadingView 0.1.1

BALoadingView 0.1.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2015 年 9 月

Bryan Antigua维护。




  • Bryan Antigua

概述

example1 example2

一个提供多个加载动画的 UIView。


要求

  • 适用于任何 iOS 设备


示例

要运行示例项目,请在 repo 中克隆,并首先从 Example 目录运行 pod install


开始使用

安装

简单使用

startAnimation

要将 BALoadingView 添加到您的应用程序中,请添加以下行:

BALoadingView *view = [[BALoadingView alloc] initWithFrame:self.view.frame];
[self.loadingView initialize];
[self.loadingView startAnimation:BACircleAnimationFullCircle];
//OR [self.loadingView startAnimation:BACircleAnimationSemiCircle];

这将默认创建以下动画/按钮

example3a

传递 BACircleAnimationSemiCircle 枚举将生成

example3b

stopAnimation

stopAnimation 从视图中移除动画。

高级使用

下面列出了您可以控制的几个属性的示例。

初始化

initialize 设置默认值,应在设置任何属性之前调用。

持续时间

如果您想使加载动画持续更久/更短,您可以编辑 duration 属性

BALoadingView *loadingView = [[BALoadingView alloc] initWithFrame:self.view.frame];
[self.loadingView initialize];
self.loadingView.duration = 20.0f;
self.loadingView.segmentColor = [UIColor whiteColor];
[self.loadingView startAnimation:BACircleAnimationFullCircle];

这将创建以下视图

example4

顺时针方向

编辑 clockwise 布尔属性可以改变整个圆动画的方向

BALoadingView *loadingView = [[BALoadingView alloc] initWithFrame:self.view.frame];
[self.loadingView initialize];
self.loadingView.clockwise = YES;
self.loadingView.segmentColor = [UIColor whiteColor];
[self.loadingView startAnimation:BACircleAnimationFullCircle];

这将创建以下视图

example5

段颜色

segmentColor 属性控制段的颜色,可以像上面示例中那样使用

线端

lineCap 属性控制半圆动画的端点。下面的示例是圆形端点选项

[self.loadingView initialize];
self.loadingView.lineCap = kCALineCapRound;
self.loadingView.clockwise = true;
self.loadingView.segmentColor = [UIColor whiteColor];
[self.loadingView startAnimation:BACircleAnimationFullCircle];

动画看起来像这样

example6

作者

Bryan Antigua, [email protected] - bryanantigua.com

授权

BALoadingView遵循MIT许可协议。更多信息请查看LICENSE文件。