12
I suspect you could use techniques described in this post
Modifying the code presented there slightly, you subclass UISearchBar:
@interface SearchBar : UISearchBar {
}
@end
Then in your implementation:
- (void)layoutSubviews {
UITextField *searchField;
NSUInteger numViews = [self.subviews count];
for(int i = 0; i < numViews; i++) {
if([[self.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) {
searchField = [self.subviews objectAtIndex:i];
}
}
if(!(searchField == nil)) {
searchField.textColor = [UIColor redColor];
}
[super layoutSubviews];
}
I haven't tested either the original post's code or this code, but looks like it ought to work. -wkw