This bellow code for change the cancel button of UISearchBar
for (UIView *possibleButton in searchBar.subviews)
{
if ([possibleButton isKindOfClass:[UIButton class]])
{
UIButton *cancelButton = (UIButton*)possibleButton;
cancelButton.enabled = YES;
[cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
[cancelButton setBackgroundImage:[UIImage imageNamed:@"mainbg1.png"] forState:UIControlStateNormal];
[cancelButton setBackgroundImage:[UIImage imageNamed:@"mainbg.png"] forState:UIControlStateHighlighted];
break;
}
}
No comments:
Post a Comment