UIView.animate - Swift 3 - 完成
UIView.animate - Swift 3 - completion
如何在 Swift 3 中完成一个简单的完成块?
我想在动画完成时设置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 几乎是不可能的,因为互联网上什么都没有:(
我还搜索了整个文档,甚至没有提到 "animate" 这个词,但找不到任何内容:
你这样添加:
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
})
如何在 Swift 3 中完成一个简单的完成块?
我想在动画完成时设置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 几乎是不可能的,因为互联网上什么都没有:(
我还搜索了整个文档,甚至没有提到 "animate" 这个词,但找不到任何内容:
你这样添加:
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
})