3

I can't figure out why there is this white line appearing when I click in the search text field. The only way to prevent it from happening is to make the navigationBar.isTranslucent = false, but this is not an ideal solution. Does anyone know why this might be happening and how to fix it?

class SearchViewController: UIViewController {

    let searchController = UISearchController(searchResultsController: nil)
    searchController.searchResultsUpdater = self
    searchController.obscuresBackgroundDuringPresentation = false
    searchController.searchBar.delegate = self
    searchController.searchBar.placeholder = "Search..."
    navigationItem.searchController = searchController
    navigationItem.hidesSearchBarWhenScrolling = false
    definesPresentationContext = true

    ...
}

Update

I've determined that the UITabBarController is to blame for this annoyance, but I don't know why or how to fix it.

enter image description here

Kevin_TA
  • 4,575
  • 13
  • 48
  • 77
  • Are you able to identify the view within the hierarchy browser? Is it potentially the shadow image (see https://stackoverflow.com/questions/19226965/how-to-hide-uinavigationbar-1px-bottom-line)? – Jamie Edge May 08 '18 at 18:14
  • @Jamie tried a bunch of these solutions but nothing worked. I've determined that it is related to this view being embedded in a `UITabBarController`. – Kevin_TA May 08 '18 at 19:44
  • Did you ever figure this out? I have the same issue. – Swindler Sep 25 '18 at 17:34

0 Answers0