override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.navigationBar.prefersLargeTitles = true
}
我设置了推送页面
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Detail"
view.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
self.navigationController?.navigationBar.prefersLargeTitles = false
}
系统设置页面,返回动画非常流畅。 甚至还有缩放动画,这应该是Apple API包含的。
答案 0 :(得分:1)
我建议您在退出第二个视图控制器时尝试设置viewWillDisappear
方法:
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.navigationBar.prefersLargeTitles = true
}
然后,在viewWillAppear
中执行此操作:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.navigationBar.prefersLargeTitles = false
}
这将确保在不同风格上的平滑过渡