找到一种方法,从SearchBar内部的TextFiled进行改变,代码如下:
- (void)setSearchBarTextfiled:(UISearchBar *)searchBar{
for (UIView *view in searchBar.subviews){
for (id subview in view.subviews){
if ( [subview isKindOfClass:[UITextField class]] ){
[(UITextField *)subview setTintColor:[UIColor redColor]]; //游标
[(UITextField *)subview setFont:[MyFont fontSize:18]];
[(UITextField *)subview setTextColor:[UIColor blackColor]];
return;
}
}
}
}
用searchBar对象调用就好了
网友评论