我正在尝试使用iOS 8中的新UISearchController
,并将其UISearchBar
嵌入到我的UINavigationBar
中。操作如下:
searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.delegate = self
searchController.searchBar.delegate = self
searchController.dimsBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
navigationItem.titleView = searchController.searchBar
但是当我添加了作用域按钮:
searchController.searchBar.showsScopeBar = true
searchController.searchBar.scopeButtonTitles = ["Posts, Users, Subreddits"]
它将按钮添加到 UISearchBar
后面,显然看起来非常奇怪。
我应该如何做这件事?