UISearchController SearchBar changes after click cancel button

折月煮酒 提交于 2021-02-10 16:38:33

问题


I have UISearchController in my app:

    searchController = UISearchController(searchResultsController: nil)
    searchController.searchResultsUpdater = self
    if #available(iOS 9.1, *) {
        searchController.obscuresBackgroundDuringPresentation = false
    }

    searchController.searchBar.frame = searchBarView.frame

    searchBarView.addSubview(searchController.searchBar)
    searchController.searchBar.delegate = self

The problem is that when I enter the SearchBar and then click the cancel button the search bar not back to the frame I define here(and stretched to full size screen):

searchController.searchBar.frame = searchBarView.frame

Any idea what can be the problem?

来源:https://stackoverflow.com/questions/57647341/uisearchcontroller-searchbar-changes-after-click-cancel-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!