//输入框背景色
bar.searchBarStyle = UISearchBarStyleMinimal;
[bar positionAdjustmentForSearchBarIcon:UISearchBarIconSearch];
// 改变UISearchBar内部输入框样式
UIView *searchTextField = nil;
searchTextField = [[[bar.subviews firstObject] subviews] lastObject];
// 改变输入框背景色
searchTextField.subviews[0].backgroundColor = [UIColor purpleColor];
// searchTextField.layer.cornerRadius = 5.0;