Strange behavior UISearchBar on Iphone6

179 views Asked by At

In my app i need to have a UISearchBar inside a cell.

Everything works fine, except in the iPhone6. Where lines appear in the search´s background.

enter image description here

Any idea why this and only in the iPhone6´s model? My configuration is:

  • Search Style: Prominent
  • Bar Style: Default
  • Translucent:NO
  • BarTint:WhiteColor
3

There are 3 answers

0
DaSilva On BEST ANSWER

If i change the style of the searchbar to minimal it removes the lines, but also it mess my custom colors. The solution i found was to add a clear color to the backgroundImage and set the desired color:

_seachBar.backgroundImage = [[UIImage alloc] init];
_seachBar.backgroundColor = kColor_App_LightGray;

It´s work now, but i still don't have a explanation to this strange behavior only on the iPhone6. Any better solution or advise will be well receive. Thanks

0
Tech_Intelliswift On

Try this to remove the background view of searchBarItem

for (UIView *backGroundView in self.searchBarItem.subviews)
    {
        if ([backGroundView isKindOfClass:NSClassFromString
             (@"UISearchBarBackground")])
        {
            [backGroundView removeFromSuperview];
            break;
        }
    }
1
GJDK On

Just try changing the "search style" of the UISearchBar as "Minimal". I faced a similar kinda issue and I resolved it by changing style from "Default" to "Minimal".