[英]Searchcontroller only available on iOS 11 or newer
I'm trying to make my app iOS 9 compliant. 我正在尝试使我的应用程序符合iOS 9。 But I get this error for the navigationItem.searchController
: 但是我得到了navigationItem.searchController
这个错误:
'searchController' is only available on iOS 11.0 or newer
How can I make this available for iOS 9 without changing every search logic through the app? 如何在不更改应用程序的每个搜索逻辑的情况下使此功能可用于iOS 9?
You cannot set the navigation item's searchController
before iOS 11, but you can certainly use the UISearchController, just as we've done for years. 您无法在iOS 11之前设置导航项的searchController
,但是可以肯定地可以使用UISearchController,就像我们多年以来所做的那样。 Simply extract the UISearchController's searchBar
and put it, yourself, wherever you want it in the interface. 只需提取UISearchController的searchBar
并将其放置在界面中的searchBar
位置即可。 If you want it as or in the navigation bar, then put it there. 如果您希望它显示为或在导航栏中,则将其放在此处。 For example, make it the navigation item's titleView
. 例如,使其成为导航项的titleView
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.