1、UIButton设置为disabled且不变灰的解决方法:
当我们将一个UIButton的enable设置为NO后,按钮通常会变灰一些,想它不变灰,可以设置:
_nextBtn.adjustsImageWhenDisabled = NO;
_nextBtn.enabled =NO;
2、UISearchBar点击键盘的search时,右上角的取消按钮不变灰色的解决办法:
- (void)searchBarSearchButtonClicked:(UISearchBar*)searchBar
{
[self.topSearchBarresignFirstResponder];
//处理searchBar失去焦点后,取消变灰的操作
UIButton*cancelBtn = [searchBarvalueForKey:@"cancelButton"];//首先取出cancelBtn
cancelBtn.enabled=YES;//把enabled设置为yes
}