Search code examples
iosswifttableviewuisearchcontroller

SearchController changes the size of tableView


The size of my tableView mysteriously changes heights when the search controller is active like the images I attached below.

The image in the far left is the initial state. Middle image is when the search controller is active and the last image is when the search controller is dismissed.

enter image description here

I tried setting the content size of the tableview when the search controller is active, in the viewDidLoad, viewWillAppear and viewDidAppear without any luck.

Any idea on how to resolve this problem?

P.S. The items you see are just dummy posts.


Solution

  • Try set edgesForExtendedLayout property to be under Top Bar using code or storyboard