我的设计类似于以下流程。我需要将第5步和第6步之间的延迟设置为0.3秒。我尝试了以下选项,但没有任何结果。
我的问题是,我该如何实现?
注意:观看动画需要13秒。
流量
测试1
Timer.scheduledTimer(withTimeInterval: 13, repeats: false, block: {})
测试2
UIView.animate(withDuration: 13, animations: {
// nothing should be happened
self.ivSuccessMark.alpha = 0.99 // for dummy animation diff
}, completion: { (completion) in
// navigation
})
测试3
答案 0 :(得分:0)
尝试这个
UIView.animate(withDuration: 0.5, delay: 0.3, options: [.repeat, .curveEaseOut, .autoreverse], animations: {
// animation stuff
}, completion: { _ in
// do stuff once animation is complete
})
答案 1 :(得分:0)
尝试此操作,希望对您有所帮助(最多4秒,停止所有操作在视图中)
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(4), execute: {
// Put your code which should be executed with a delay here
})