我想隐藏/显示代码中某些条件的部分:
if condition == true{
section.hidden = false
}else{
section.hidden = true
}
section.evaluateHidden()
它有效,但我想在部分显示时运行一些自定义动画...
我找到一个回调名称sectionsHaveBeenAdded:
override func sectionsHaveBeenAdded(_ sections: [Section], at indexes: IndexSet) {
}
是吗???
或者如何做到这一点以及在哪里编写自定义动画代码??? 谢谢!!!
最佳答案
希望这段代码能帮助您在隐藏、取消隐藏 View 时制作动画
UIView.animate(withDuration: 0.5, delay: 0.0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.8, options: .curveEaseInOut, animations: {
self.section.transform = CGAffineTransform.identity
}) { (completed:Bool) in
// Completion block
self.section.backgroundColor = UIColor(displayP3Red: 0.0, green: 0.0, blue: 0.0, alpha: 0.3)
self.section.isOpaque = true
}
关于ios - 显示Section时如何自定义动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50056204/