gpt4 book ai didi

ios - 动画后执行 segue 需要很长时间

转载 作者:行者123 更新时间:2023-11-30 13:25:58 25 4
gpt4 key购买 nike

我正在尝试在 Swift 中的动画完成 block 中执行转场。然而,segue 需要很长时间(大约 10 秒)才能完成,我不知道为什么。代码如下:

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

imageViewAnimated.startAnimating()


if label.center != CGPoint(x:50, y:10) {

UIView.animateWithDuration(2.0, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: { () -> Void in
self.label.center = self.view.center

}, completion: nil)

UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: { () -> Void in
self.label.alpha = 0.0

}, completion: { finished in

self.poof.alpha = 1.0
self.performSegueWithIdentifier("backSegue", sender: nil)
})
}
}

最佳答案

 override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)

imageViewAnimated.startAnimating()


if label.center != CGPoint(x:50, y:10) {

UIView.animateWithDuration(2.0, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: { () -> Void in
self.label.center = self.view.center

}, completion: nil)

UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: { () -> Void in
self.label.alpha = 0.0

}, completion: { finished in

self.poof.alpha = 1.0
dispatch_async(dispatch_get_main_queue(),{
self.performSegueWithIdentifier("backSegue", sender: nil)
})
})
}
}

关于ios - 动画后执行 segue 需要很长时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37192260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com