UIView * topView = search.subviews[0];
for(UIView * subView in topView.subviews){
if([subView isKindOfClass:NSClassFromString(@"UINavigationButton")]){
UIButton * cancelButton =(UIButton *)subView;
if(cancelButton){
//修改取消按钮颜色
cancelButton.tintColor = [UIColor darkGrayColor];
}
}
if([subView isKindOfClass:NSClassFromString(@"UISearchBarBackground")]){
//默认样式颜色太深 直接把背景移除
[subView removeFromSuperview];
}
}
网友评论