ios – Searchbar Position with navigation controller


image1
image2

The searchbar is created behind the navigationbar by default. It becomes visible when I scroll up.

override func viewDidLoad() {
    super.viewDidLoad()

    configureViewController()
    configureSearchController()
    configureCollectionView()
    getFollowers(username: username, page: page)
    configureDataSource()
}

func configureSearchController() {
    let searchController = UISearchController()
    searchController.searchResultsUpdater = self
    searchController.searchBar.delegate = self
    searchController.searchBar.placeholder = "Search for a username"
    searchController.obscuresBackgroundDuringPresentation = false
    navigationItem.searchController = searchController
}

It’s not about navigationItem.hidesSearchBarWhenScrolling.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img