2013-08-20 65 views
1

我试图改变的UISearchBar的外观,得到以下结果的UISearchBar完全自定义的背景

Custom Search Bar http://imageshack.com/a/img194/3835/jhl7.png

我试图与UIAppearance方法,并且还通过移除UISearchBarBackground,但似乎边界的文本字段不能被删除。

我得到的最好的结果是:

actual search bar

的问题不是放大镜,但边界:)

+0

你可能会发布一些代码吗? –

+0

你的酒吧风格是什么? – Kepler

+0

@KirillProkopovich:酒吧风格是默认的,改为黑色或黑色半透明无论如何不会解决我的问题。 – LiohAu

回答

3

尝试清除颜色设置为您serch主页吧:

[[UISearchBar appearance] setTintColor:[UIColor clearColor]]; 

或试试看:

UIImage *searchBg = [UIImage imageNamed:@"Search_Background.png"]; 
searchBg = [searchBg stretchableImageWithLeftCapWidth:10 topCapHeight:10]; //experiment with values 
[[UISearchBar appearance] setSearchFieldBackgroundImage: [[UIImage imageNamed: @"background-search"]; 
+0

不,它不起作用,这是我用清晰的颜色获得:http://img43.imageshack.us/img43/6342/rcfr.png – LiohAu

+0

我编辑答案,检查它。 – Kepler

+0

well setBackgroundImage本身并没有解决问题,但这和ANDSelectFieldBackgroundImage工作的搜索栏。我现在必须检查范围。 – LiohAu