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

标签 ios swift eureka-forms

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

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/

相关文章:

ios - 使用 MVC 的 iOS 游戏,模型是否应该在将其 UIViewImage 对象保留在 ViewController 中的同时具有 objRect?

ios - 如何在 UITests 下重新排序单元格?

Swift 将 Eureka 日期转换为 String 以进行 firebase 存储

swift - Eureka - DateRow 加载日期而不改变其当前值

Swift Eureka - 自定义行 "cannot convert to expected argument type BaseRow"

ios - 从自定义 UitableViewCell 中保存 textField.text

ios - iTunes 崩溃日志为 "dyld message: Library not loaded..."

ios - 此类对于键 <key> 不符合键值编码,其中 <key> 不在代码中(swift,Xcode 6)

macos - 提交到 Mac 应用商店时出现收据验证错误

ios - 如何在堆栈 View 中居中对齐 View ,而不是拉伸(stretch)任何 View 或分布?