简体   繁体   English

Searchcontroller仅在iOS 11或更高版本上可用

[英]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.

相关问题 Xcode 11 向后兼容性:“UIWindowScene 仅适用于 iOS 13 或更高版本” - Xcode 11 backward compatibility: "UIWindowScene is only available in iOS 13 or newer" Xcode 11 beta -playbackState 仅在 iOS 13.0 或更新版本中可用 - Xcode 11 beta - playbackState is only available in iOS 13.0 or newer Xcode 11 “'==' 仅在 iOS 13.0 或更高版本中可用”错误 - Xcode 11 “'==' is only available in iOS 13.0 or newer” error 'setNewsstandIconImage'仅在iOS 9.0或更高版本上可用 - 'setNewsstandIconImage' is only available on iOS 9.0 or newer Flutter:AVCapturePhotoOutput' 仅适用于 iOS 10.0 或更高版本 - Flutter: AVCapturePhotoOutput' is only available on iOS 10.0 or newer 'LABiometryType'仅适用于iOS 11.0.1或更高版本 - 'LABiometryType' is only available on iOS 11.0.1 or newer “ AppDelegate”仅在iOS 10.0或更高版本上可用 - 'AppDelegate' is only available on iOS 10.0 or newer centerXAnchor仅在iOS 9.0或更高版本中可用? - centerXAnchor is only available in iOS 9.0 or newer? “ NSBatchDeleteRequest”仅在iOS 9.0或更高版本上可用 - 'NSBatchDeleteRequest' is only available on iOS 9.0 or newer 'NSPersistentContainer'仅适用于iOS 10.0或更高版本 - 'NSPersistentContainer' is only available on iOS 10.0 or newer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM