Swift支持自定义的指示器小控件
应用介绍
作者BearLatte,源码TIMProgressHUD,Swift 非常好用的指示器小控件,可根据自己的需要定制主题颜色,自定义动画等。已适配 Swift 5.0, 可以完美适配暗黑模式和普通模式的切换
如果使用的好的话,希望您不要吝啬,赏小的一颗小星星,谢谢!
本项目参考了Harley-xk 的 Chrysan. 原作者项目中采用了 Objective-C 的添加关联对象的方式动态将控件添加到 View 以及 ViewController 中,个人觉得不太 Swift。所以产生了本项目,我的思路是使用 RxSwift 的添加前缀的方式通过泛型将控件添加到 View 以及 ViewController 中。具体步骤可以参考 Demo。
Example - 代码示例
运行demo可以得到以下效果
Requirements - 必要条件
Xcode 10.0 ~>
Swift 5.0 ~>
Installation - 导入方式
Cocoapods - 使用 Cocoapods 导入方法:
TIMProgressHUD 可以通过 Cocoapods 进行导入,也可以通过源代码进行导入,在你项目中的 Podfile 中添加以下代码:
TIMProgressHUD is available through CocoaPods. To install it, simply add the following line to your Podfile:
# 如果是 Cocoapods 1.8.0 版本或以上的用户请添加 CocoaPods 源在你的 Podfile 文件最顶部添加source 'https://github.com/CocoaPods/Specs.git' # 添加这一句,不然会报 cdn 错误target 'xxx' do pod 'TIMProgressHUD'end
打开命令行工具,进入到 Podfile 所在文件夹,执行 pod install
或 pod update
Open Terminal;
Go to the directory where Podfile is located;
Execute pod install
or pod update
.
Source code - 源代码导入
Download the TIMProgressHUD via zip;
通过 zip 的方式下载源代码;
Drag the TIMProgressHUD folder into your project (Don't forget tick the checkbox that copy item if needed);
拖拽 TIMProgressHUD 文件夹到你的项目中(不要忘记勾选 copy item if needed 复选框);
Useg - 使用方式
If you installed TIMProgressHUD via Cocoapods , where you need it
import TIMProgressHUD
. Use the following statement to call up the control.如果你通过 Cocoapods 导入本项目,在你需要的地方或者项目的全局父类中
import TIMProgressHUD
。使用以下语句吊起控件。If you installed TIMProgressHUD via source code, Use the following statement to call up the control.
如果你通过源代码的方式安装本项目,可以直接使用下面的语句吊起控件。
tm.progressHUD.show()
Author - 作者
Tim, guoyong19890907@gmail.com

©软件著作权归作者所有。本站所有内容均来源于网络,不得违法使用,仅供学习使用,请支持正版!
转载请注明出处: 662P » Swift支持自定义的指示器小控件
发表评论 取消回复