0
我有一個UITableView
,其中我將其標題設置爲搜索欄。當我專注於搜索欄,它跳轉到屏幕的頂部,在設備上比iOS11正常工作時,我沒有使用視圖導航欄,我想在表的頂部固定搜索欄iOS 11,搜索欄從表跳轉到頂部HeaderView
self.definesPresentationContext = true
self.extendedLayoutIncludesOpaqueBars = true;
searchController.delegate = self
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.placeholder = NSLocalizedString("SEARCH_BOX_TEXT", bundle: bundle!, comment: "Search box text")
searchController.searchBar.sizeToFit()
searchController.searchBar.barTintColor = UIColor.lightGray
searchController.searchBar.setValue(NSLocalizedString("SEARCH_BAR_CANCEL_BUTTON", bundle: bundle!, comment: "Search bar cancel button"), forKey: "_cancelButtonText")
productListTable.tableHeaderView = searchController.searchBar
前:
後,我聚焦到搜索欄:
的[iOS的11個搜索欄跳躍到屏幕頂部]可能的複製(https://stackoverflow.com/questions/45798923/ios- 11-search-bar-jumping-to-top-of-screen) – D1mers0n
@ D1mers0n,我頂部沒有導航欄,鏈接中提供的答案不能解決我的問題,也沒有任何接受的答案 – kakajan