我有一个View
-ScrollView
-View
,无法使导航完全透明。我为层次结构中的所有3个部分设置了0,0,0,0约束。
在我的ViewController
中,我有以下代码:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
我在这里上传了测试项目-https://github.com/cluelessoodles/testScrollView