Reputation: 177
I have a View
- ScrollView
- View
and am having trouble making the navigation completely transparent. I have set 0,0,0,0 constraints for all 3 parts in the hierarchy.
In my ViewController
I have the following code:
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)
}
However, this shortens the white navigation but does not make it transparent to the top, like this:
I uploaded my test project here - https://github.com/cluelessoodles/testScrollView
Upvotes: 1
Views: 91
Reputation: 1
What I understand is that you want the Status bar to also be "transparent". For that make sure your constraints are set to TOP = 0 relative to the main view (for the scroll view and the view you added inside the scroll). Also, by doing this, you will have scrollable content behind the status bar and I am not sure if that's the behaviour you are looking for.
Upvotes: 0
Reputation:
When setting the constraints make sure you did not set them on the Save Area but on the Parent View, this should do the trick if I understood your question correctly
Upvotes: 0
Reputation: 4446
You pinned your view top the safe area, not the view. Make sure you select the top level view when creating your top constraint, not the safe area:
This applies to the bottom constraint as well if you want it to stretch to the very bottom of the iPhone X screen.
Upvotes: 1