2

I have a table view with a search bar. But, when I click the search bar it seems that the Navigation Bar expands and creates a blank white space beneath it. However, this only occurs when self.navigationController?.navigationBar.isTranslucent = false but when I comment this line, the white space never appears. Also, the white bar appears only when I press the search bar. Here are some pictures for reference:

  1. This is when I don't press the search bar.
  2. Then when I press the search bar a white space appears under it.
  3. And then when I cancel out of the search bar the white space is between the navigation bar and the search bar.

This is when I don't press the search bar.

Then when I press the search bar a white space appears under it.

And then when I cancel out of the search bar the white space is between the navigation bar and the search bar.

1 Answers1

0

Add this line in viewDidLoad:

 self.automaticallyAdjustsScrollViewInsets = false
Maddy
  • 1,660
  • 11
  • 24