小编Hun*_*ocz的帖子

搜索栏隐藏在导航栏下方

我在表格视图中添加了一个搜索栏。我还有一个导航栏,它应该出现在其下方。在我点击搜索栏之前它工作得很好。当我在屏幕尺寸较大的设备(iPhone 6 以上)上执行此操作时,搜索栏会隐藏在导航栏下方。它在实际的 iPhone 5、5s 上按预期工作。这就是我初始化 searchBar 的方式:

    searchController.searchResultsUpdater = self as UISearchResultsUpdating
    searchController.dimsBackgroundDuringPresentation = false
    definesPresentationContext = true
    tableView.tableHeaderView = searchController.searchBar
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.searchBar.tintColor = UIColor.black


    searchController.searchBar.scopeButtonTitles = ["Device", "Person", "OS version"]
    searchController.searchBar.delegate = self as UISearchBarDelegate
Run Code Online (Sandbox Code Playgroud)

在点击搜索栏之前

当我点击搜索栏后

搜索栏不应该隐藏,因为当我搜索时我也需要导航栏上的分段控件。您知道我该如何解决这个问题吗?

更新: 设置扩展边缘后,搜索栏如下所示: 导航栏颜色改变了

当我点击搜索栏时

iphone xcode ios swift

1
推荐指数
1
解决办法
2439
查看次数

标签 统计

ios ×1

iphone ×1

swift ×1

xcode ×1