mirror of https://github.com/xaoxuu/ProHUD
修复定时器失效问题
This commit is contained in:
parent
17b46e7ed9
commit
a77f1a4356
|
@ -118,6 +118,12 @@ class DemoToastVC: ListVC {
|
|||
section.add(title: "标题 + 正文") {
|
||||
TestToast(.title(title).message(message))
|
||||
}
|
||||
section.add(title: "防止重复") {
|
||||
TestToast(.identifier("toast").title(title).message(message).duration(2))
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
TestToast(.identifier("toast").title(title).message(message).duration(2))
|
||||
}
|
||||
}
|
||||
section.add(title: "一段长文本") {
|
||||
// Toast(.message(message))
|
||||
// 可以简写成这样:
|
||||
|
|
|
@ -73,8 +73,12 @@ open class AlertTarget: BaseController, HUDTargetType {
|
|||
|
||||
/// 视图模型
|
||||
@objc public var vm: AlertViewModel? {
|
||||
willSet {
|
||||
vm?.cancelTimer()
|
||||
}
|
||||
didSet {
|
||||
vm?.vc = self
|
||||
vm?.restartTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ open class CapsuleTarget: BaseController, HUDTargetType {
|
|||
}
|
||||
didSet {
|
||||
vm?.vc = self
|
||||
vm?.restartTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,12 @@ open class ToastTarget: BaseController, HUDTargetType {
|
|||
|
||||
/// 视图模型
|
||||
@objc public var vm: ToastViewModel? {
|
||||
willSet {
|
||||
vm?.cancelTimer()
|
||||
}
|
||||
didSet {
|
||||
vm?.vc = self
|
||||
vm?.restartTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue