我正在向我的UITableView的標題添加searchBar,並希望能夠在用戶滾動單元格時使用它。即使在將樣式更改爲UITableViewStyleGrouped後,Tableview標題也不可滾動
我已經嘗試了一切,例如設置樣式爲UITableViewStyleGrouped但它沒有解決我的問題。
這裏是代碼
var searchController: UISearchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar
任何理由,被頭停留在停止?
@conarch不是一個有用的答案,但它沒有任何與搜索欄。問題在於標題,因爲它應該在滾動內容的同時滾動。 – Siyavash
我假定搜索欄b/c是您提供的代碼。我的意思是,你已經把它作爲表頭。這是TABLE標題,所以它不應該滾動。 – ghostatron
@conarch我在頁眉視圖中顯示searchBar,所以即使我添加一個空視圖,我也會得到相同的結果。 – Siyavash