1

I have a search bar that looks like this: enter image description here

Is there anyway to remove that black border on the top?

I tried the minimal bar approach but got: enter image description here

So the border was removed but now I would need to somehow color the inner field white.

I tried:

        if let searchTextField = searchBar.valueForKey("searchField") as? UITextField {
             searchTextField.backgroundColor = UIColor.whiteColor()

    }

But it didn't seem to change anything.

I'm looking for a solution to either of these problems. I just want the pink border with the white text field.

Edit:

There is a similar question for iOS7 but the accepted answer did not work for me.

Deekor
  • 9,144
  • 16
  • 69
  • 121
  • possible duplicate of [Remove Border of UISearchBar in iOS7](http://stackoverflow.com/questions/19899642/remove-border-of-uisearchbar-in-ios7) – JAL Jun 10 '15 at 20:47
  • @JAL i tried the accepted answer there with no luck. Might've changed in iOS8 – Deekor Jun 10 '15 at 20:53
  • Try iterating through the subviews like in this answer: http://stackoverflow.com/a/26273321/2415822. Remember, just because the answer has been accepted doesn't mean it works for everyone. Look at all the answers. – JAL Jun 10 '15 at 20:55

1 Answers1

0

Creating an image filled with the pink color:

enter image description here

And setting it as the backgroundImage for the search bar did the trick.

Community
  • 1
  • 1
Deekor
  • 9,144
  • 16
  • 69
  • 121