Muddu Patil
Muddu Patil

Reputation: 721

Unable to change the color of UISearchBar

I'm using UISearchBar in my app its look likes below enter image description here

I want UISearchBar color to be clear color i tried the following search.backgroundColor = [UIColor blackColor]; but the result is same can any one help me please.

Upvotes: 1

Views: 673

Answers (2)

MD SHAHIDUL ISLAM
MD SHAHIDUL ISLAM

Reputation: 14523

UIColor *color = [UIColor redColor];

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
    searchBar.barTintColor = color; //for iOS 7
} else {
    searchBar.tintColor = color; //for earlier than iOS 7
}

Upvotes: 0

AppsGuy24
AppsGuy24

Reputation: 33

Try tintColor:

    search.tintColor = [UIColor blackColor];

Upvotes: 2

Related Questions