I have found that the code in my AppDelegate
:
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil]
setFont:[UIFont systemFontOfSize:14]];
works to change the font of a UISearchBar
created from IB. No problems there.
However, if I create the UISearchBar
in code as such:
UISearchBar *bar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
bar.placeholder = @"test";
[self.view addSubview:bar];
Then the above UITextField
appearance code has no effect. Is there a way to change the font of a programmatically created UISearchBar
?
Thank you!