I\'m trying to remove border of UISearchBar in iOS 7. In iOS 6 it\'s working fine. I created the UISearchBar programatically. I tried almost every thing from Stack Overflow
Swift 2.1 in Xcode 7.2, this worked for me.
self.searchController.searchBar.backgroundImage = UIImage()
My full code below.
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
self.searchController.searchBar.sizeToFit()
tableView.sectionIndexBackgroundColor = UIColor(red: 0/255, green: 181/255, blue: 229/255, alpha: 1.0)
self.searchController.searchBar.backgroundColor = UIColor(red: 0/255, green: 181/255, blue: 229/255, alpha: 1.0)
self.searchController.searchBar.barTintColor = UIColor(red: 0/255, green: 181/255, blue: 229/255, alpha: 1.0)
self.searchController.searchBar.backgroundImage = UIImage()
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar