3
我試圖在MasterViewController的表頭上添加一個搜索欄(UISearchController)時出現問題。 正如你所看到的,表格正在搜索欄下。 關於如何解決此問題的任何想法?UITableView下的MasterViewController UISearchBar(UISplitViewController)
這裏是我使用的MasterViewController
private var searchController : UISearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
return controller
})()
override func viewDidLoad() {
super.viewDidLoad()
navigationController?.navigationBar.translucent = false
self.edgesForExtendedLayout = .None
self.extendedLayoutIncludesOpaqueBars = false
self.automaticallyAdjustsScrollViewInsets = false
searchController.searchResultsUpdater = self
searchController.searchBar.delegate = self
self.tableView.tableHeaderView = searchController.searchBar
if let split = self.splitViewController {
let controllers = split.viewControllers
self.detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
}
}
嘗試'取消
Under Top Bars
definesPresentationContext = true'爲你的'searchController' – Santosh我試過了,什麼都沒有發生。我認爲問題出在'UISplitViewController'上,因爲我在iPhone上的UITableViewController上使用了這些代碼,並且它工作正常。 –