0
votes

I have a UINavigationBar with a search button. The search button triggers a UISearchController:

self.navigationItem.titleView = self.searchController.searchBar
self.searchController.searchBar.becomeFirstResponder()

When a user selects a search result, a new ViewController is pushed. If the user then taps back they are presented with the old ViewController with the still active search results.

If they then tap Cancel to dismiss the UISearchController, the UINavigationBar now covers the content in the view. I think it may be my setting of self.definesPresentationContext to true in viewDidLoad and false when the next viewController is presented

Process from left to right

1

1 Answers

0
votes

If you think that you know the cause of the issue, have you tried commenting out those lines? Does it still do it then?

It sounds to me more like something to do with the UIViewController's automaticallyAdjustsScrollViewInsets property.

Try setting that to false on your UIViewController.

EDIT:

Have you tried changing the UIViewController's edgesForExtendedLayout property?

self.edgesForExtendedLayout = UIRectEdgeNone;