С открытым исходным кодом ваш друг (как какао, да):
- (void)setSearchIconToFavicon {
// Really a UISearchBarTextField, but the header is private.
UITextField *searchField = nil;
for (UIView *subview in searchBar.subviews) {
if ([subview isKindOfClass:[UITextField class]]) {
searchField = (UITextField *)subview;
break;
}
}
if (searchField) {
UIImage *image = [UIImage imageNamed: @"favicon.png"];
UIImageView *iView = [[UIImageView alloc] initWithImage:image];
searchField.leftView = iView;
[iView release];
}
}
Начиная с iOS 5.0:
[self.testSearchBar setImage:[UIImage imageNamed: @"favicon.png"]
forSearchBarIcon:UISearchBarIconSearch
state:UIControlStateNormal];