Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement both UISearchController and UISearchDisplayController

Tags:

ios

ios8

I'm trying to make my iOS7 app work on iOS8 and I saw that the UISearchController replaces the UISearchDisplayController in iOS8.

Of course I can use UISearchController instead of UISearchDisplayController, but than my app is no longer working on iOS7.

How can I make my app work on both iOS versions? Do I need to make another storyboard for iOS8?

Thanks in advance

like image 777
Maurice Avatar asked Aug 08 '14 17:08

Maurice


1 Answers

If your Deployment Target is set to iOS 7 and you wish to support iOS 8, you can still use UISearchDisplayController and it should run without issue on iOS 8, and without warnings presented in Xcode. I have not experienced any misbehavior with my apps that implement UISearchDisplayController. When I decide to no longer support iOS 7, then I will replace it completely with UISearchController.

You may be able to detect the OS version and implement UISearchController programmatically if 8+, but if you're using a Storyboard it would be difficult to implement both unless you create two different Storyboards, one for each OS. But I don't really find that necessary when you need to support the previous OS. Deprecation normally does not mean it will not work anymore when running on the latest OS, but rather it's just not recommended to use anymore because there are better solutions available. It's rare when deprecated methods do not work properly when run on newer iOS versions.

like image 126
Jordan H Avatar answered Oct 21 '22 14:10

Jordan H