What is the best most efficient way to implement a UISearchBar
?
I check all over the internet, and all the tutorials are for the ios 7
version, and a lot of the methods are deprecated in ios 8
. Can someone please provide a library, or a sample of how to implement a searchBar
in xcode for ios 8
?
I had to do the same you are doing a few months ago. So, I found this on GitHub: https://github.com/dempseyatgithub/Sample-UISearchController
Download/clone it and you'll be able to see how to use UISearchController with UITableView and UICollectionView. It has everything you need to upgrade from UISearchDisplayController to UISearchController. The UISearchController documentation is also really helpful.
If you also need to support iOS 7(something I personally recommend if you are really about to deploy your app to the App Store) do this:
if([UISearchController class]){
//Create an UISearchController and add it to your UITableViewController
}else{
//Create an UISearchDisplayController and add it to your UITableViewController
}
Note: You'll have to do everything programatically if you want to support both versions of iOS.
Best regards,
Gabriel Tomitsuka