I have researched this problem a lot but I have found no solution that would work for me.
Basically, I have a UIViewController
that presents UISearchController
like this:
let searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.delegate = self
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.delegate = self
view.addSubview(searchController.searchBar)
User is then expected to tap the UISearchBar
to present searchController
and reveal the keyboard. However, a strange thing happens during the transition between controllers.
It seems as if the UISearchController
didn't cover the status bar and let you see the UIViewController
that presented it below. I would like to find a way to prevent this, i.e. to force the search controller to extend all the way under the status bar.
Things that I have already done:
- I have set
self.definesPresentationContext = true
inviewDidLoad:
. - I have found out that this is a known bug, namely rdar://20942583.
I have attempted to circumvent the bug by setting:
self.edgesForExtendedLayout = .All self.extendedLayoutIncludesOpaqueBars = true
It didn't work.
I'm running out of ideas. Please help.
Thanks a bunch, Pete.