//输入框背景颜色设置
UIView *searchTextField = [[[self.searchBar.subviewsfirstObject]subviews]lastObject];
searchTextField.backgroundColor = [UIColorcolorWithHexString:@"#1c232c"withAlpha:1];
//文字颜色设置
for (UIView *subView in self.searchBar.subviews)
{
for (UIView *secondLevelSubview in subView.subviews){
if ([secondLevelSubview isKindOfClass:[UITextField class]])
{
UITextField *searchBarTextField = (UITextField *)secondLevelSubview;
//set font color here
searchBarTextField.textColor = [UIColor colorWithHexString:@"#676f7d" withAlpha:1];
break;
}
}
}