3

In my app, I am using UISearchBar in a custom UIView.

Following is the code to display the UISearchBar.

searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(50, 135, 230, 32)];
searchBar.barTintColor = [UIColor clearColor];
searchBar.placeholder = @"Search";
[self addSubview:searchBar];

In iOS 7.0.3, bartint color not showing,

enter image description here

However in iOS 7.1, the bartint color is not hiding.

enter image description here

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Ronald Randon
  • 1,141
  • 3
  • 13
  • 19
  • 1
    What does [`backGroundImage`](https://developer.apple.com/library/ios/documentation/uikit/reference/UISearchBar_Class/Reference.html#//apple_ref/occ/instp/UISearchBar/backgroundImage) do? Or does [this](http://stackoverflow.com/a/12598711/1971013) help you? – meaning-matters May 19 '14 at 10:27
  • Yes. [searchBar setBackgroundImage:[UIImage new]]; Does the trick!!! – Ronald Randon May 19 '14 at 10:38

1 Answers1

10

It seems that this does the trick:

[searchBar setBackgroundImage:[UIImage new]];
meaning-matters
  • 21,929
  • 10
  • 82
  • 142