我在 Swift 3 中制作了一个带有 tableView 的应用程序,其标题中有一个 searchBar 。 searchBar 还有一个带有scopeButton 的栏。
在 iOS 10 中,搜索栏滑动到导航栏所在的位置,一切正常。然而,在 iOS 11 中,当 searchBar 变为活动状态时,tableView 会在 searchBar 下方滑动,因此第一个单元格几乎完全被覆盖。
当我现在点击一个单元格移动到另一个视图并返回时,scopeButton 移动到搜索栏下方。现在第一个单元格再次可见,但到搜索栏的距离有点大,当然范围按钮完全无法使用。
我还将我的项目转换为 Swift 4,但这没有帮助。
我正在使用 Xcode 9 GM 和 iOS 11 GM。
这是我的代码:
let searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad() {
super.viewDidLoad()
UINavigationBar.appearance().titleTextAttributes = accordFont
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar
searchController.searchBar.barTintColor = UIColor(hue: 0.5, saturation: 0.43, brightness: 0.82, alpha: 1.0)
searchController.searchBar.placeholder = "Suchen"
self.navigationController?.navigationBar.barTintColor = UIColor(hue: 0.5, saturation: 0.43, brightness: 0.82, alpha: 1.0)
searchController.searchBar.setValue("Abbruch", forKey:"_cancelButtonText")
searchController.searchBar.delegate = self
searchController.searchBar.scopeButtonTitles = ["Name", "Büro Nr.", "Mobil Nr.", "Abteilung"]
searchController.searchBar.keyboardAppearance = .dark
}
这就是我点击搜索栏时的样子:截屏 https://i.stack.imgur.com/Wyf88.png
正如您所看到的,第一个单元格几乎被完全覆盖。
这是当我在 searchBar 处于活动状态时单击单元格然后返回到 tableView 时发生的情况:截屏 https://i.stack.imgur.com/ewXF7.png
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)