需求
- iOS 8.0+
- Xcode 8.0+
- Swift 3.0+
安装
CocoaPods
如果尚未安装,请使用以下命令安装CocoaPods:
$ gem install cocoapods
CocoaPods 1.1.0+是构建CustomLoader所必需的
要使用CocoaPods将CustomLoader集成到您的Xcode项目中,在Podfile中指定它
platform :ios, '8.0'
use_frameworks!
target '<Your Target Name>' do
pod 'CustomLoader'
end
这将安装CustomLoader的最新版本
使用以下命令应用您的配置:
$ pod install
使用方法
显示加载视图
import CustomLoader
LoadingView.standardProgressBox.show(inView: view)
移除加载视图
view.removeLoadingViews(animated: true)
自定义进度环
public extension ProgressRingView {
public static var appProgressRing: ProgressRingView {
let view = ProgressRingView()
view.outterColor = .red
view.innerColor = .blue
return view
}
}
public extension LoadingView {
public static var appLoadingView: LoadingView {
return LoadingView(loaderView: ProgressRingView. appProgressRing)
}
}
查看器中的加载器
static var myLoader: LoadingView {
let loaderView = UIActivityIndicatorView(activityIndicatorStyle: .gray)
loaderView.startAnimating()
return LoadingView(loaderView: loaderView)
}
展示自定义加载器
LoadingView.appLoadingView.show(inView: view)
或者
LoadingView.myLoader.show(inView: view)