UISearchBar barTintColor clearColor error in iOS 8.0

ⅰ亾dé卋堺 提交于 2019-12-07 16:31:21

问题


In my app i am using UISearchBar in xib with Xcode 6. And i have given bar tin color is clear color. It's working on iOS 7.1 below.

But main problem is in iOS 8.0 it's not working clear color. It's displaying black color.

See Image :

Any one having adventurous of this issue.


回答1:


I had the same problem in search bar so i changed the Search style from default to Minimal.

And it changed the bar style.




回答2:


You can add a 1x1 pixel transparence image as background image to UISearchBar. It would be a dirty workaround. I think Apple should fix this issue.




回答3:


You have to set UISearchBar tint color.

    UISearchBar *search=[[UISearchBar alloc]initWithFrame:CGRectMake(10, 20, 100, 20)];
    [search setBarTintColor:[UIColor clearColor]];
    search.backgroundImage=[UIImage new];
    self.navigationItem.titleView=search;



来源:https://stackoverflow.com/questions/25784884/uisearchbar-bartintcolor-clearcolor-error-in-ios-8-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!