问题
I have a viewController
that has x 2 container views in it that hold x 2 different tableViews
. I use a segmentControl
at the top of the main view to switch between these two tableViews. It works just fine.
On one of the tableViews I want to drill down to show yet another tableView. Problem is, when I do it leaves a blank white space at the top of the view where the segment used to be (at least I think that is what is causing the white space.)
How do I ensure the tableView
sits snuggly under the navigation bar?
Here are some images for reference:
1. Is the main view containing a segment control.
2. Is the container view.
Selecting a segment brings up a view like the one below. Which is fine.
But when I drill down I get this:
I can scroll up, no problem, and manually place the image under the nav bar, so this tells me its not that the view is not big enough.
How do I remove that white space above the image?
Thanks in advance.
回答1:
In your EventDetailVC
add these line in viewDidLoad
method
self.automaticallyAdjustsScrollViewInsets = false
If it not solve set translucent
property of navigationBar
to true
self.navigationController.navigationBar.translucent = true
回答2:
An alternative solution can be this as well. Uncheck the Adjust Scroll View Insets and your problem will be solved.
来源:https://stackoverflow.com/questions/38365355/white-space-at-top-of-tableview-embedded-in-a-container-view