DAOSearchBar
DAOSearchBar is based on INSSearchBar: https://github.com/berlininsomniac/INSSearchBar_Swift
It is a 3rd-party search bar with beautiful animation. Unfortunately, it seems like INSSearchBar is no longer update anymore.
So, heres the DAOSearchBar.
Swift 3.0 supported.
Now you can custom the search bar background and the magnifier icon color.
RequirementiOS 9.0
Swift 3.0
XCode 8
InstallationCocoaPodspod 'DAOSearchBar', '~> 1.0.1'UsageSearch bar without delegateself.searchBarWithoutDelegate.frame = CGRect(x: 20.0, y: 40.0, width: self.view.bounds.width - 40.0, height: 34.0) self.view.addSubview(self.searchBarWithoutDelegate)Search bar with delegateclass ViewController: UIViewController, INSSearchBarDelegate {}self.searchBarWithDelegate.frame = CGRect(x: 20.0, y: 140.0, width: 44.0, height: 34.0) self.searchBarWithDelegate.delegate = self; self.view.addSubview(self.searchBarWithDelegate)Custom colorself.searchBarWithCustomColor.searchOffColor = UIColor.darkGray self.searchBarWithCustomColor.searchOnColor = UIColor.white self.searchBarWithCustomColor.searchBarOffColor = UIColor.white self.searchBarWithCustomColor.searchBarOnColor = UIColor.darkGrayDelegatefunc destinationFrameForSearchBar(_ searchBar: INSSearchBar) -> CGRect { return CGRect(x: 20.0, y: 140.0, width: self.view.bounds.size.width - 40.0, height: 34.0) }func searchBar(_ searchBar: INSSearchBar, willStartTransitioningToState destinationState: INSSearchBarState) { // Do whatever you deem necessary. }func searchBar(_ searchBar: INSSearchBar, didEndTransitioningFromState previousState: INSSearchBarState) { // Do whatever you deem necessary. }func searchBarDidTapReturn(_ searchBar: INSSearchBar) { // Do whatever you deem necessary. // Access the text from the search bar like searchBar.searchField.text }func searchBarTextDidChange(_ searchBar: INSSearchBar) { // Do whatever you deem necessary. // Access the text from the search bar like searchBar.searchField.text },论文,开题报告