0
votes

I've embed UISearchController into the navigationbar and my view controller has the table view. When I click on searchbar and keyboard appears tableview and searchbar does not animate smoothly. It seems like searchbar is overlaping navigationbar.

Here is the code,

Declare searchcontroller as a variable like,

var resultSearchController = UISearchController()

and defination in viewDidLoad is like,

self.resultSearchController = ({
        let controller = UISearchController(searchResultsController: nil)
        controller.searchResultsUpdater = self
        controller.obscuresBackgroundDuringPresentation = false;
        self.navigationItem.searchController = controller
        return controller
    })()

Animation issue is like below gif(watch till end to see slow animation)

enter image description here

I want same duration for animation for tableview, navigation bar, and searchbar.

Any help will be appreciated.

1

1 Answers

2
votes

Don't set UITableView top anchor to be pinned to safeArea but to superview.