you can change the UISearchBar background using this bellow code..
for (UIView *subview in searchBar.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
UIView *bg = [[UIView alloc] initWithFrame:subview.frame];
bg.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"SkyBackground.jpeg"]];
[searchBar insertSubview:bg aboveSubview:subview];
[subview removeFromSuperview];
break;
}
}
From this code you can set image or anything else for background of UISearchBar.
Also see my this answer with some other functionality to change the searchbar component layout..How to change inside background color of UISearchBar component on iOS
UPDATE:
for change the Cancel button appearance use this bellow code...
UIButton *cancelButton = nil;
for(UIView *subView in searchBar.subviews)
{
if([subView isKindOfClass:[UIButton class]])
{
cancelButton = (UIButton*)subView;
//do something here with this cancel Button
}
}