thecloud_of_unknowing thecloud_of_unknowing - 7 months ago 40
iOS Question

White space at top of tableView embedded in a container view

I have a

that has x 2 container views in it that hold x 2 different
. I use a
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
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.
enter image description here

Selecting a segment brings up a view like the one below. Which is fine.

enter image description here

But when I drill down I get this:

enter image description here

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.


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