【问题标题】:Searchcontroller only available on iOS 11 or newerSearchcontroller 仅适用于 iOS 11 或更高版本
【发布时间】:2018-07-14 16:54:24
【问题描述】:

我正在尝试使我的应用程序兼容 iOS 9。但我收到navigationItem.searchController 的此错误:

'searchController' is only available on iOS 11.0 or newer

如何在不通过应用更改每个搜索逻辑的情况下使其适用于 iOS 9?

【问题讨论】:

  • 您可以单独使用搜索栏和表格
  • 对于低于 iOS 11 的系统,您必须使用 UISearchBar

标签: ios swift uisearchcontroller


【解决方案1】:

在 iOS 11 之前您无法设置导航项的 searchController,但您当然可以使用 UISearchController,就像我们多年来所做的那样。只需提取 UISearchController 的 searchBar 并将其放在您自己想要的界面中的任何位置。如果您希望它作为导航栏或在导航栏中,则将其放在那里。例如,将其设为导航项的titleView

【讨论】:

  • 你的工作示例已被删除......所以死链接。下次贴代码。
猜你喜欢
  • 2018-07-04
  • 2020-08-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多