gpt4 book ai didi

ios - UIView.animate - Swift 3 - 完成

转载 作者:IT王子 更新时间:2023-10-29 07:53:22 24 4
gpt4 key购买 nike

我如何在 Swift 3 中做一个简单的完成 block ?

我想在动画完成时设置self.isOpen = true:

            UIView.animate(withDuration: 0.25, delay: 0.0, options: [], animations: {
self.isOpen = true
self.drawerView?.frame = CGRect(x: 0, y: 0, width: (self.drawerView?.frame.size.width)!, height: (self.drawerView?.frame.size.height)!)
self.contentView?.frame = CGRect(x: 200, y: 0, width: (self.contentView?.frame.size.width)!, height: (self.contentView?.frame.size.height)!)
}, completion: nil)

顺带一提:

由于互联网上什么都没有,所以学习 Swift 3 atm 几乎是不可能的:(


我还搜索了整个文档,甚至没有提到“动画”一词,但找不到任何内容:

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/index.html#//apple_ref/doc/uid/TP40014097-CH3-ID0

最佳答案

你这样添加:

UIView.animate(withDuration: 0.25, delay: 0.0, options: [], animations: {
self.drawerView?.frame = CGRect(x: 0, y: 0, width: (self.drawerView?.frame.size.width)!, height: (self.drawerView?.frame.size.height)!)
self.contentView?.frame = CGRect(x: 200, y: 0, width: (self.contentView?.frame.size.width)!, height: (self.contentView?.frame.size.height)!)
}, completion: { (finished: Bool) in
self.isOpen = true
})

关于ios - UIView.animate - Swift 3 - 完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39682128/

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