我知道如何删除/更改UISearchBar搜索字段周围的背景颜色:
[[self.searchBar.subviews objectAtIndex:0] removeFromSuperview];
self.searchBar.backgroundColor = [UIColor grayColor];
Run Code Online (Sandbox Code Playgroud)

但是不知道如何在里面这样做:

这需要与iOS 4.3+兼容.
在我的iPhone应用程序中,我正在尝试将背景图像设置为UISearch Bar,我的图像未显示.
这是我的代码
UISearchBar * tempSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake( 0, 0, self.view.bounds.size.width, 40 )];
self.searchBar = tempSearchBar;
tempSearchBar.delegate = self;
self.searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
self.searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
self.searchBar.barStyle = UIBarStyleBlack;
self.searchBar.backgroundColor=[UIColor clearColor];
self.searchBar.backgroundImage=[UIImage imageNamed:@"Searchbox.png"];
self.searchBar.placeholder = @"Search My Data";
[self.searchBar sizeToFit];
[self.view addSubview:self.searchBar];
[tempSearchBar release];
Run Code Online (Sandbox Code Playgroud)