1

我正在尝试更改 UISearchBar 的外观以获得以下结果

自定义搜索栏 http://imageshack.com/a/img194/3835/jhl7.png

我尝试使用 UIAppearance 方法,也尝试删除 UISearchBarBackground,但似乎无法删除文本字段的边框。

我得到的最好结果是:

实际搜索栏

问题不是放大镜,而是边框:)

4

1 回答 1

3

尝试为您的搜索栏设置清晰的颜色:

[[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"];
于 2013-08-20T15:59:36.927 回答