RSLoadingView
简介
RSLoadingView
借助 3D 引擎,将您的应用带入加载动画的新时代。
- 使用 Swift 编写
- 高度可定制
- 使用 Apple 的 SceneKit 和 OpenGL
- 包含 HUB 功能:一行代码即可显示全屏加载 HUB
- 或作为独立视图使用
- 在界面构建器中可配置
要求
- Swift 4.0
- iOS 9+
演示
SpinAlone - base
版本
SpinAlone - base
版本
SpinAlone - inAndOut
版本;speedFactor = 2.0;lifeSpanFactor = 2.0;mainColor = UIColor.red
Twins - base
版本
安装
RSLoadingView 通过 CocoaPods 提供。要安装它,只需在你的 Podfile 中添加以下行
pod "RSLoadingView"
使用
import UIKit
import RSLoadingView
class ViewController: UIViewController {
@IBAction func showLoadingHub() {
let loadingView = RSLoadingView()
loadingView.show(on: view)
}
@IBAction func showOnViewTwins() {
let loadingView = RSLoadingView(effectType: RSLoadingView.Effect.twins)
loadingView.show(on: view)
}
func hideLoadingHub() {
RSLoadingView.hide(from: view)
}
@IBAction func showOnWindow() {
let loadingView = RSLoadingView()
loadingView.showOnKeyWindow()
}
func hideLoadingHubFromKeyWindow() {
RSLoadingView.hideFromKeyWindow()
}
}
支持的效果
效果 | 变体 |
---|---|
RSLoadingSpinAlone | base, inAndOut |
RSLoadingTwins | base |
RSLoadingTriples | (即将推出) |
自定义
加载视图相关
字段 | 默认值 |
---|---|
speedFactor | 1.0 |
mainColor | UIColor.white |
colorVariation | 0.0 |
sizeFactor | 1.0 |
spreadingFactor | 1.0 |
lifeSpanFactor | 1.0 |
variantKey | "" |
HUB 相关
字段 | 默认值 |
---|---|
shouldDimBackground | true |
dimBackgroundColor | UIColor.black.withAlphaComponent(0.6) |
isBlocking | true |
shouldTapToDismiss | false |
sizeInContainer | CGSize(width: 180, height: 180) |
作者
Roy Ng, [邮箱地址保护中] @ Redso, https://www.redso.com.hk/
领英: https://www.linkedin.com/in/roy-ng-19427735/
许可
RSLoadingView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。