Custom background and Keyboard appearance alert type
-(void)setSearchBarBg{
for (UIView *subview in searchBar.subviews) {
NSLog(@"%@",[subview class]);
if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
// remove from superView and through XIB select a image in background of UISearchBar
[subview removeFromSuperview];
}
else if([subview isKindOfClass: [UITextField class]])
{
// for key board alert type UIKeyboardAppearanceAlert
[(UITextField *)subview setKeyboardAppearance: UIKeyboardAppearanceAlert];
}
}
}
-(void)setSearchBarBg{
for (UIView *subview in searchBar.subviews) {
NSLog(@"%@",[subview class]);
if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
// remove from superView and through XIB select a image in background of UISearchBar
[subview removeFromSuperview];
}
else if([subview isKindOfClass: [UITextField class]])
{
// for key board alert type UIKeyboardAppearanceAlert
[(UITextField *)subview setKeyboardAppearance: UIKeyboardAppearanceAlert];
}
}
}
No comments:
Post a Comment