mirror of https://github.com/xaoxuu/ProHUD
update
This commit is contained in:
parent
29fa9f13c0
commit
4217c5a98c
|
@ -89,7 +89,8 @@ class TestToastVC: BaseListVC {
|
|||
}
|
||||
} else if row == 7 {
|
||||
Toast.find("aaa", last: { (t) in
|
||||
t.update { (vm) in
|
||||
t.pulse()
|
||||
t.update() { (vm) in
|
||||
vm.title = "已经存在了"
|
||||
}
|
||||
}) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public extension ProHUD {
|
|||
public var vm = ViewModel()
|
||||
|
||||
// MARK: 生命周期
|
||||
internal var isLoadFinished = false
|
||||
private var isLoadFinished = false
|
||||
|
||||
/// 实例化
|
||||
/// - Parameter scene: 场景
|
||||
|
@ -180,7 +180,7 @@ public extension Alert {
|
|||
return Alert(scene: scene, title: title, message: message, actions: actions).push()
|
||||
}
|
||||
|
||||
/// 获取指定的实例
|
||||
/// 查找指定的实例
|
||||
/// - Parameter identifier: 指定实例的标识
|
||||
class func find(_ identifier: String?) -> [Alert] {
|
||||
var aa = [Alert]()
|
||||
|
|
|
@ -49,7 +49,7 @@ public extension ProHUD {
|
|||
public var isFullScreen = false
|
||||
|
||||
/// 是否正在显示
|
||||
private var displaying = false
|
||||
private var isDisplaying = false
|
||||
|
||||
/// 背景颜色
|
||||
public var backgroundColor: UIColor? = UIColor(white: 0, alpha: 0.4)
|
||||
|
@ -57,7 +57,7 @@ public extension ProHUD {
|
|||
public var vm = ViewModel()
|
||||
|
||||
// MARK: 生命周期
|
||||
internal var isLoadFinished = false
|
||||
private var isLoadFinished = false
|
||||
|
||||
/// 实例化
|
||||
/// - Parameter title: 标题
|
||||
|
@ -106,10 +106,10 @@ public extension Guard {
|
|||
view.snp.makeConstraints { (mk) in
|
||||
mk.edges.equalToSuperview()
|
||||
}
|
||||
if displaying == false {
|
||||
if isDisplaying == false {
|
||||
privTranslateOut()
|
||||
}
|
||||
displaying = true
|
||||
isDisplaying = true
|
||||
UIView.animateForGuard {
|
||||
self.privTranslateIn()
|
||||
}
|
||||
|
@ -124,16 +124,16 @@ public extension Guard {
|
|||
|
||||
/// 从父视图控制器弹出
|
||||
func pop() {
|
||||
if displaying {
|
||||
if isDisplaying {
|
||||
debug("pop")
|
||||
willDisappearCallback?()
|
||||
displaying = false
|
||||
isDisplaying = false
|
||||
view.isUserInteractionEnabled = false
|
||||
self.removeFromParent()
|
||||
UIView.animateForGuard(animations: {
|
||||
self.privTranslateOut()
|
||||
}) { (done) in
|
||||
if self.displaying == false {
|
||||
if self.isDisplaying == false {
|
||||
self.view.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public extension Guard {
|
|||
return Guard(actions: actions).push(to: viewController)
|
||||
}
|
||||
|
||||
/// 获取指定的实例
|
||||
/// 查找指定的实例
|
||||
/// - Parameter identifier: 指定实例的标识
|
||||
class func find(_ identifier: String?, from viewController: UIViewController? = nil) -> [Guard] {
|
||||
var gg = [Guard]()
|
||||
|
|
|
@ -173,6 +173,8 @@ public extension Toast {
|
|||
vm.tapCallback = callback
|
||||
}
|
||||
|
||||
/// 图片旋转效果
|
||||
/// - Parameter rotate: 是否开启
|
||||
func animate(rotate: Bool) {
|
||||
if rotate {
|
||||
DispatchQueue.main.async {
|
||||
|
@ -187,6 +189,21 @@ public extension Toast {
|
|||
}
|
||||
}
|
||||
|
||||
/// 脉冲效果
|
||||
func pulse() {
|
||||
DispatchQueue.main.async {
|
||||
UIView.animate(withDuration: 0.2, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: [.allowUserInteraction, .curveEaseOut], animations: {
|
||||
self.window?.transform = .init(scaleX: 1.04, y: 1.04)
|
||||
}) { (done) in
|
||||
UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 1, options: [.allowUserInteraction, .curveEaseIn], animations: {
|
||||
self.window?.transform = .identity
|
||||
}) { (done) in
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,7 +219,7 @@ public extension Toast {
|
|||
return Toast(scene: scene, title: title, message: message, duration: duration, actions: actions).push()
|
||||
}
|
||||
|
||||
/// 获取指定的toast
|
||||
/// 查找指定的实例
|
||||
/// - Parameter identifier: 标识
|
||||
class func find(_ identifier: String?) -> [Toast] {
|
||||
var tt = [Toast]()
|
||||
|
|
Loading…
Reference in New Issue