我正在尝试对我的应用程序的“注册”部分进行编码。 我为此使用大标题。如果我使用普通的 ViewController,一切都很好,但如果我使用 TableViewController,当我更改 ViewController 时,我的过渡非常糟糕:
我可以看到黑色背景。您知道我该如何纠正这个问题吗?
编辑:如果我设置 isTranslucent = true,没关系,但我想要一个白色的导航栏。你知道该怎么做吗?
override func viewDidLoad(){
super.viewDidLoad()
if #available(iOS 11.0, *) {
// tableView.contentInsetAdjustmentBehavior = .never
self.navigationController?.navigationBar.prefersLargeTitles = true
}
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.navigationBar.shadowImage = UIImage()
}
@IBAction func continueAction(_ sender: Any) {
let signupSecondVC = self.storyboard?.instantiateViewController(withIdentifier: "SignupSecondViewController") as! SignupSecondViewController
self.navigationController?.pushViewController(signupSecondVC, animated: true)
}
编辑2:
let img = UIImage(named: "backgroundNav")
navigationController?.navigationBar.setBackgroundImage(img, for: .default)
导航栏仍然是半透明的,即使 imageBackground 是不透明的......
最佳答案
将导航栏的 isTranslucent
设置为 true
并通过其 backgroundImage
控制其颜色.
关于ios - Swift - 使用 tableView 的大标题过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50453773/