如何在显示Section时自定义动画?

时间:2018-04-27 06:04:46

标签: ios swift eureka-forms

我想隐藏/显示代码中某些条件的部分:

if condition == true{
  section.hidden = false
}else{
  section.hidden = true
}
section.evaluateHidden()

它起作用了,但我想在Section显示时运行一些自定义动画......

我找到了一个回调名称sectionsHaveBeenAdded:

override func sectionsHaveBeenAdded(_ sections: [Section], at indexes: IndexSet) {

}

是吗???

或者怎么做以及在哪里编写自定义动画代码??? 感谢!!!

1 个答案:

答案 0 :(得分:0)

希望此代码可以帮助您隐藏,取消隐藏视图动画

 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
            }