
NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(3),target: self,selector: "functionHere",userInfo: nil,repeats: false)
如果您有任何想法,请告诉我.
let pulseAnimation = CABasicAnimation(keyPath: "opacity") pulseAnimation.duration = 1 pulseAnimation.fromValue = 0 pulseAnimation.tovalue = 1 pulseAnimation.timingFunction = camediatimingFunction(name: kcamediatimingFunctionEaseInEaSEOut) pulseAnimation.autoreverses = true pulseAnimation.repeatCount = FLT_MAX XBoxOneL.layer.addAnimation(pulseAnimation,forKey: "animateOpacity") XBoxOneR.layer.addAnimation(pulseAnimation,forKey: "animateOpacity")解决方法 利用UIVIEw.animate(withDuration :)的完成处理程序.基本样本如下:
func performMyAnimation() { UIVIEw.animate(withDuration: {$duration},animations: { /* Animation Here */ },completion: { _ in self.performSegue(withIDentifIEr: "segueIDentifIErHere",sender: nil) }} 您的动画在动画块中运行.完成后,您将执行segue到下一个屏幕.
编辑:由于问题现在包括动画代码,使用CABasicAnimation,然后可能this answer for CAAnimation回调可能适合您.
基本上,您需要使用CATransaction包装CABasicAnimation调用.
CATransaction.begin()CATransaction.setCompletionBlock({ self.performSegue(withIDentifIEr: "segueIDentifIErHere",sender: nil)})// Your animation hereCATransaction.commit() 总结 以上是内存溢出为你收集整理的ios – 在swift中延迟运行动画全部内容,希望文章能够帮你解决ios – 在swift中延迟运行动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)