单击取消按钮后,UISearchController SearchBar发生更改

时间:2019-08-25 15:27:31

标签: ios swift iphone uisearchbar

我的应用中有UISearchController

    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

问题在于,当我输入SearchBar并单击“取消”按钮时,搜索栏不会回到我在此处定义的框架(并拉伸到全尺寸屏幕):

searchController.searchBar.frame = searchBarView.frame

有什么问题吗?

0 个答案:

没有答案